Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Add "Calendars" module menu item

Aaron Contrerasdf1e822354e6
diff --git a/modules/calendar/lib/open_project/calendar/engine.rb b/modules/calendar/lib/open_project/calendar/engine.rb
index d99e4d0c87b..03648a7ae6e 100644
--- a/modules/calendar/lib/open_project/calendar/engine.rb
+++ b/modules/calendar/lib/open_project/calendar/engine.rb
@@ -42,6 +42,17 @@ module OpenProject::Calendar
end
# TODO: Add calendar icon to module menu item when Global Calendar Page is added
+ menu :top_menu,
+ :calendar_view, { controller: '/calendar/calendars', action: 'index', project_id: nil },
+ context: :modules,
+ caption: :label_calendar_plural,
+ icon: 'calendar',
+ after: :work_packages,
+ if: Proc.new {
+ OpenProject::FeatureDecisions.more_global_index_pages_active? &&
+ (User.current.logged? || !Setting.login_required?) &&
+ User.current.allowed_to_globally?(:view_calendar)
+ }
menu :project_menu,
:calendar_view,
diff --git a/modules/calendar/spec/features/calendars_index_spec.rb b/modules/calendar/spec/features/calendars_index_spec.rb
index c286360085c..1f1bb705fde 100644
--- a/modules/calendar/spec/features/calendars_index_spec.rb
+++ b/modules/calendar/spec/features/calendars_index_spec.rb
@@ -65,7 +65,27 @@ RSpec.describe 'Calendars', 'index', :js, :with_cuprite do
let(:current_user) { user }
- context 'when visiting from a global context' do
+ context 'when navigating via the modules menu', with_flag: { more_global_index_pages: true } do
+ before do
+ login_as current_user
+
+ visit root_path
+
+ wait_for_reload
+
+ find("a[title='Modules']").click
+ within '#more-menu' do
+ click_on 'Calendars'
+ end
+ end
+
+ it 'is reachable' do
+ expect(page).to have_current_path(calendars_path)
+ expect(page).to have_text 'There is currently nothing to display.'
+ end
+ end
+
+ context 'when visiting from a global context', with_flag: { more_global_index_pages: true } do
let(:queries) { [query, other_query] }
before do