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 the `Activity` items to the global menu

Aaron Contrerasd1aa21783ae1
diff --git a/app/controllers/activities_controller.rb b/app/controllers/activities_controller.rb
index 1ec234df12f..0fc2c11dcb7 100644
--- a/app/controllers/activities_controller.rb
+++ b/app/controllers/activities_controller.rb
@@ -105,7 +105,7 @@ class ActivitiesController < ApplicationController
end
def respond_html
- render locals: { menu_name: project_or_global_activity_menu }
+ render locals: { menu_name: project_or_global_menu }
end
def respond_atom
diff --git a/app/controllers/concerns/layout.rb b/app/controllers/concerns/layout.rb
index bd1b13f8b56..93641495fcc 100644
--- a/app/controllers/concerns/layout.rb
+++ b/app/controllers/concerns/layout.rb
@@ -47,13 +47,5 @@ module Layout
:global_menu
end
end
-
- def project_or_global_activity_menu
- if @project
- :project_menu
- else
- :global_activities_menu
- end
- end
end
end
diff --git a/config/initializers/menus.rb b/config/initializers/menus.rb
index b95e5a7b3ea..f0d087eedf3 100644
--- a/config/initializers/menus.rb
+++ b/config/initializers/menus.rb
@@ -126,6 +126,17 @@ Redmine::MenuManager.map :global_menu do |menu|
menu.push :home,
{ controller: '/homescreen', action: 'index' },
icon: 'home'
+
+ # Activity
+ menu.push :activity,
+ { controller: '/activities', action: 'index' },
+ icon: 'checkmark'
+
+ menu.push :activity_filters,
+ { controller: '/activities', action: 'index' },
+ parent: :activity,
+ partial: 'activities/filters_menu'
+
# Work packages
menu.push :work_packages,
{ controller: '/work_packages', action: 'index' },
diff --git a/spec/features/activities/activity_page_navigation_spec.rb b/spec/features/activities/activity_page_navigation_spec.rb
index 98cfb6daf60..d0cb5da7be5 100644
--- a/spec/features/activities/activity_page_navigation_spec.rb
+++ b/spec/features/activities/activity_page_navigation_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Activity page navigation', js: true do
+RSpec.describe 'Activity page navigation', :js, :with_cuprite do
include ActiveSupport::Testing::TimeHelpers
shared_let(:project) { create(:project, enabled_module_names: Setting.default_projects_modules + ['activity']) }
@@ -59,6 +59,18 @@ RSpec.describe 'Activity page navigation', js: true do
current_user { user }
+ describe 'global menu item' do
+ it 'allows navigating to the global activity page' do
+ visit root_path
+
+ within '#main-menu' do
+ click_link 'Activity'
+ end
+
+ expect(page).to have_current_path(activity_index_path)
+ end
+ end
+
it 'stays on the same period when changing filters' do
visit project_activity_index_path(project)
click_link('Previous')
diff --git a/spec/lib/redmine/menu_manager_spec.rb b/spec/lib/redmine/menu_manager_spec.rb
index 94ea1d6381b..a0e75dcad8f 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 do
context 'for the global_menu' do
it 'includes the expected items' do
expect(described_class.items(:global_menu).map(&:name))
- .to include(:home, :work_packages, :cost_reports_global)
+ .to include(:home, :activity, :work_packages, :cost_reports_global)
end
end