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 `Meetings` menu item to the global menu
Aaron Contreras9126c9cccef9
diff --git a/modules/meeting/app/controllers/meetings_controller.rb b/modules/meeting/app/controllers/meetings_controller.rbindex 6656d0490e2..8c1d1541205 100644--- a/modules/meeting/app/controllers/meetings_controller.rb+++ b/modules/meeting/app/controllers/meetings_controller.rb@@ -37,6 +37,7 @@ class MeetingsController < ApplicationControllerhelper :watchershelper :meeting_contents+ include Layoutinclude WatchersHelperinclude PaginationHelperinclude SortHelper@@ -45,6 +46,7 @@ class MeetingsController < ApplicationControllerdef index@meetings = @project ? @project.meetings : global_upcoming_meetings+ render 'index', locals: { menu_name: project_or_global_menu }enddef showdiff --git a/modules/meeting/lib/open_project/meeting/engine.rb b/modules/meeting/lib/open_project/meeting/engine.rbindex 0d85082ea5b..eb56ebd9eb6 100644--- a/modules/meeting/lib/open_project/meeting/engine.rb+++ b/modules/meeting/lib/open_project/meeting/engine.rb@@ -63,16 +63,25 @@ module OpenProject::Meetingbefore: :members,icon: 'meetings'+ should_render_global_menu_item = Proc.new do+ OpenProject::FeatureDecisions.more_global_index_pages_active? &&+ (User.current.logged? || !Setting.login_required?) &&+ User.current.allowed_to_globally?(:view_meetings)+ end+menu :top_menu,:meetings, { controller: '/meetings', action: 'index', project_id: nil },context: :modules,caption: :label_meeting_plural,icon: 'meetings',- if: Proc.new {- OpenProject::FeatureDecisions.more_global_index_pages_active? &&- (User.current.logged? || !Setting.login_required?) &&- User.current.allowed_to_globally?(:view_meetings)- }+ if: should_render_global_menu_item++ menu :global_menu,+ :meetings, { controller: '/meetings', action: 'index', project_id: nil },+ caption: :label_meeting_plural,+ last: true,+ icon: 'meetings',+ if: should_render_global_menu_itemActiveSupport::Inflector.inflections do |inflect|inflect.uncountable 'meeting_minutes'diff --git a/modules/meeting/spec/features/meetings_global_menu_item_spec.rb b/modules/meeting/spec/features/meetings_global_menu_item_spec.rbnew file mode 100644index 00000000000..66cccd8fec4--- /dev/null+++ b/modules/meeting/spec/features/meetings_global_menu_item_spec.rb@@ -0,0 +1,72 @@+# frozen_string_literal: true++# -- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2023 the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+# +++#++require 'spec_helper'++RSpec.describe 'Meetings global menu item',+ :with_cuprite,+ with_flag: { more_global_index_pages: true } do+ let(:user_without_permissions) { create(:user) }+ let(:admin) { create(:admin) }++ let(:meetings_label) { I18n.t(:label_meeting_plural) }++ before do+ login_as current_user+ visit root_path+ end++ context 'as a user with permissions' do+ let(:current_user) { admin }++ it 'navigates to the global meetings index page' do+ within '#main-menu' do+ click_link meetings_label+ end++ expect(page).to have_current_path('/meetings')++ within '#main-menu' do+ expect(page).to have_selector('.selected', text: meetings_label)+ end+ end+ end++ context 'as a user without permissions' do+ let(:current_user) { user_without_permissions }++ it 'does not render' do+ within '#main-menu' do+ expect(page).not_to have_link(meetings_label)+ end+ end+ end+enddiff --git a/modules/reporting/lib/open_project/reporting/engine.rb b/modules/reporting/lib/open_project/reporting/engine.rbindex fd2f5f409aa..c3d3c7094fc 100644--- a/modules/reporting/lib/open_project/reporting/engine.rb+++ b/modules/reporting/lib/open_project/reporting/engine.rb@@ -79,7 +79,7 @@ module OpenProject::Reportingmenu :global_menu,:cost_reports_global,{ controller: '/cost_reports', action: 'index', project_id: nil },- last: true,+ after: :news,caption: :cost_reports_title,icon: 'cost-reports',if: should_renderdiff --git a/spec/lib/redmine/menu_manager_spec.rb b/spec/lib/redmine/menu_manager_spec.rbindex 70b45d4ba48..d31722af54e 100644--- a/spec/lib/redmine/menu_manager_spec.rb+++ b/spec/lib/redmine/menu_manager_spec.rb@@ -60,7 +60,8 @@ RSpec.describe Redmine::MenuManager do:team_planners,:boards,:news,- :cost_reports_global)+ :cost_reports_global,+ :meetings)endend