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

fix boards menu item in project settings

Markus Kahlaa5767e6cfec
diff --git a/modules/boards/lib/open_project/boards/engine.rb b/modules/boards/lib/open_project/boards/engine.rb
index 216ec423cbf..a3b965d9aef 100644
--- a/modules/boards/lib/open_project/boards/engine.rb
+++ b/modules/boards/lib/open_project/boards/engine.rb
@@ -54,7 +54,7 @@ module OpenProject::Boards
caption: :'boards.label_boards'
menu :top_menu,
- :boards, { controller: 'boards/boards', project_id: nil, action: 'overview' },
+ :boards, { controller: '/boards/boards', action: 'overview' },
context: :modules,
caption: :project_module_board_view,
if: Proc.new {
diff --git a/modules/boards/spec/features/menu_items/top_menu_item_spec.rb b/modules/boards/spec/features/menu_items/top_menu_item_spec.rb
new file mode 100644
index 00000000000..33e26ccd5d1
--- /dev/null
+++ b/modules/boards/spec/features/menu_items/top_menu_item_spec.rb
@@ -0,0 +1,91 @@
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-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'
+
+describe 'Top menu item for boards', js: true, selenium: true do
+ let(:user) { create(:admin) }
+
+ let(:menu) { find(".op-app-menu a[title='#{I18n.t('label_modules')}']") }
+ let(:boards) { I18n.t('boards.label_boards') }
+
+ before do
+ allow(User).to receive(:current).and_return user
+ end
+
+ shared_examples_for 'the boards menu item' do
+ it "displays the menu item" do
+ expect(page).to have_link(boards)
+ end
+
+ it "sends the user to the boards overview when clicked" do
+ click_on boards
+
+ expect(page).to have_content(boards)
+ expect(page).to have_content(I18n.t(:no_results_title_text))
+ end
+ end
+
+ context 'with more global index pages', with_flag: { more_global_index_pages: true } do
+ context 'when in the project settings' do
+ let!(:project) { create(:project) }
+
+ before do
+ visit "/projects/#{project.identifier}/settings/general"
+
+ menu.click
+ end
+
+ it_behaves_like 'the boards menu item'
+ end
+
+ context 'on the landing page' do
+ before do
+ visit root_path
+
+ menu.click
+ end
+
+ it_behaves_like 'the boards menu item'
+ end
+
+ context 'with missing permissions' do
+ let(:user) { create(:user) }
+
+ before do
+ visit root_path
+
+ menu.click
+ end
+
+ it "does not display the menu item" do
+ expect(page).not_to have_link(boards)
+ end
+ end
+ end
+end