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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Add the `Calendars` global menu item
Aaron Contrerasbe21ae4193c3
diff --git a/modules/calendar/app/controllers/calendar/calendars_controller.rb b/modules/calendar/app/controllers/calendar/calendars_controller.rbindex 5efe3490903..7b117921ca4 100644--- a/modules/calendar/app/controllers/calendar/calendars_controller.rb+++ b/modules/calendar/app/controllers/calendar/calendars_controller.rb@@ -35,11 +35,13 @@ module ::Calendarbefore_action :find_calendar, only: %i[destroy]menu_item :calendar_view+ include Layoutinclude PaginationHelperinclude SortHelperdef index@views = visible_views+ render 'index', locals: { menu_name: project_or_global_menu }enddef showdiff --git a/modules/calendar/lib/open_project/calendar/engine.rb b/modules/calendar/lib/open_project/calendar/engine.rbindex 03648a7ae6e..6c5864cec94 100644--- a/modules/calendar/lib/open_project/calendar/engine.rb+++ b/modules/calendar/lib/open_project/calendar/engine.rb@@ -41,18 +41,27 @@ module OpenProject::Calendarcontract_actions: { calendar: %i[read] }end- # TODO: Add calendar icon to module menu item when Global Calendar Page is added+ should_render = Proc.new do+ OpenProject::FeatureDecisions.more_global_index_pages_active? &&+ (User.current.logged? || !Setting.login_required?) &&+ User.current.allowed_to_globally?(:view_calendar)+ end+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)- }+ if: should_render++ menu :global_menu,+ :calendar_view,+ { controller: '/calendar/calendars', action: 'index', project_id: nil },+ caption: :label_calendar_plural,+ icon: 'calendar',+ after: :work_packages,+ if: should_rendermenu :project_menu,:calendar_view,diff --git a/modules/calendar/spec/features/calendar_dates_spec.rb b/modules/calendar/spec/features/calendar_dates_spec.rbindex c7117296ad6..5c35ed7d58e 100644--- a/modules/calendar/spec/features/calendar_dates_spec.rb+++ b/modules/calendar/spec/features/calendar_dates_spec.rb@@ -29,7 +29,7 @@require 'spec_helper'require_relative './shared_context'-RSpec.describe 'Calendar non working days', js: true do+RSpec.describe 'Calendar non working days', :js, :with_cuprite doinclude_context 'with calendar full access'let!(:other_user) dodiff --git a/modules/calendar/spec/features/calendar_widget_spec.rb b/modules/calendar/spec/features/calendar_widget_spec.rbindex f794d5d3e77..5041302dc12 100644--- a/modules/calendar/spec/features/calendar_widget_spec.rb+++ b/modules/calendar/spec/features/calendar_widget_spec.rb@@ -29,7 +29,7 @@require 'spec_helper'require_relative '../../../overviews/spec/support/pages/overview'-RSpec.describe 'Calendar drag&dop and resizing', js: true do+RSpec.describe 'Calendar Widget', :js, :with_cuprite dolet(:project) docreate(:project, enabled_module_names: %w[work_package_tracking calendar_view])end@@ -61,7 +61,6 @@ RSpec.describe 'Calendar drag&dop and resizing', js: true do# within top-left area, add an additional widgetoverview_page.add_widget(1, 1, :row, 'Calendar')- sleep(1)overview_page.expect_and_dismiss_toaster message: I18n.t('js.notice_successful_update')# Clicking the calendar entry goes to work package full screendiff --git a/modules/calendar/spec/features/calendars_index_spec.rb b/modules/calendar/spec/features/calendars_index_spec.rbindex 1f1bb705fde..c88bf26a91c 100644--- a/modules/calendar/spec/features/calendars_index_spec.rb+++ b/modules/calendar/spec/features/calendars_index_spec.rb@@ -65,23 +65,41 @@ RSpec.describe 'Calendars', 'index', :js, :with_cuprite dolet(:current_user) { user }- context 'when navigating via the modules menu', with_flag: { more_global_index_pages: true } do+ context 'when navigating to the global index page', with_flag: { more_global_index_pages: true } do+ shared_examples 'global index page is reachable' do+ it 'is reachable' do+ expect(page).to have_current_path(calendars_path)+ expect(page).to have_text 'There is currently nothing to display.'+ expect(page).to have_selector '#main-menu'+ end+ end+before dologin_as current_user-visit root_path-wait_for_reload+ end- find("a[title='Modules']").click- within '#more-menu' do- click_on 'Calendars'+ context 'with the modules menu' do+ before do+ find("a[title='Modules']").click++ within '#more-menu' do+ click_on 'Calendars'+ endend++ it_behaves_like 'global index page is reachable'end- it 'is reachable' do- expect(page).to have_current_path(calendars_path)- expect(page).to have_text 'There is currently nothing to display.'+ context 'with the global menu' do+ before do+ within '#main-menu' do+ click_on 'Calendars'+ end+ end++ it_behaves_like 'global index page is reachable'endenddiff --git a/modules/grids/spec/support/pages/grid.rb b/modules/grids/spec/support/pages/grid.rbindex b276cb71dfe..5f87212dc9f 100644--- a/modules/grids/spec/support/pages/grid.rb+++ b/modules/grids/spec/support/pages/grid.rb@@ -35,7 +35,8 @@ module Pagesexpect(page).to have_content(I18n.t('js.grid.add_widget'))- SeleniumHubWaiter.wait+ SeleniumHubWaiter.wait unless using_cuprite?+page.find('[data-qa-selector="op-grid--addable-widget"]', text: Regexp.new("^#{name}$")).clickendend@@ -81,7 +82,14 @@ module Pagesdef within_add_widget_modal(row_number, column_number, location, &)area = area_of(row_number, column_number, location)area.hover- area.find('.grid--widget-add', visible: :all).click++ add_widget_button = if using_cuprite?+ area.find('.grid--widget-add')+ else+ area.find('.grid--widget-add', visible: :all)+ end++ add_widget_button.clickwithin('.spot-modal', &)enddiff --git a/spec/lib/redmine/menu_manager_spec.rb b/spec/lib/redmine/menu_manager_spec.rbindex a0e75dcad8f..32b1d0cd787 100644--- a/spec/lib/redmine/menu_manager_spec.rb+++ b/spec/lib/redmine/menu_manager_spec.rb@@ -52,7 +52,7 @@ RSpec.describe Redmine::MenuManager docontext 'for the global_menu' doit 'includes the expected items' doexpect(described_class.items(:global_menu).map(&:name))- .to include(:home, :activity, :work_packages, :cost_reports_global)+ .to include(:home, :activity, :work_packages, :calendar_view, :cost_reports_global)endend