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

Rework `timelines.admin_menu.colors` into `label_color_plural`

Aaron Contreras2965eb68ecc3
diff --git a/app/controllers/colors_controller.rb b/app/controllers/colors_controller.rb
index 4921a1b4da4..b444bab37a2 100644
--- a/app/controllers/colors_controller.rb
+++ b/app/controllers/colors_controller.rb
@@ -103,9 +103,9 @@ class ColorsController < ApplicationController
def default_breadcrumb
if action_name == 'index'
- t('timelines.admin_menu.colors')
+ t(:label_color_plural)
else
- ActionController::Base.helpers.link_to(t('timelines.admin_menu.colors'), colors_path)
+ ActionController::Base.helpers.link_to(t(:label_color_plural), colors_path)
end
end
diff --git a/app/views/colors/index.html.erb b/app/views/colors/index.html.erb
index 73fe9440377..b32565136ec 100644
--- a/app/views/colors/index.html.erb
+++ b/app/views/colors/index.html.erb
@@ -27,9 +27,9 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
-<% html_title t(:label_administration), t("timelines.admin_menu.colors") %>
+<% html_title t(:label_administration), t(:label_color_plural) %>
-<%= toolbar title: t('timelines.admin_menu.colors') do %>
+<%= toolbar title: t(:label_color_plural) do %>
<li class="toolbar-item">
<%= link_to new_color_path,
{ class: 'button -alt-highlight',
diff --git a/config/initializers/menus.rb b/config/initializers/menus.rb
index 2591df65655..f8a2bd8743b 100644
--- a/config/initializers/menus.rb
+++ b/config/initializers/menus.rb
@@ -484,7 +484,7 @@ Redmine::MenuManager.map :admin_menu do |menu|
menu.push :colors,
{ controller: '/colors', action: 'index' },
if: Proc.new { User.current.admin? },
- caption: :'timelines.admin_menu.colors',
+ caption: :label_color_plural,
icon: 'status'
menu.push :enterprise,
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 65498ccf274..6f2f638681b 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -1662,6 +1662,7 @@ en:
label_confirmation: "Confirmation"
label_contains: "contains"
label_content: "Content"
+ label_color_plural: "Colors"
label_copied: "copied"
label_copy_same_as_target: "Same as target"
label_copy_source: "Source"
@@ -2943,7 +2944,6 @@ en:
timelines:
admin_menu:
color: "Color"
- colors: "Colors"
color_could_not_be_saved: "Color could not be saved"
edit_color: "Edit color"
empty: "(empty)"
diff --git a/spec/features/menu_items/admin_menu_item_spec.rb b/spec/features/menu_items/admin_menu_item_spec.rb
index a0385c1ef5c..86c26f01cc7 100644
--- a/spec/features/menu_items/admin_menu_item_spec.rb
+++ b/spec/features/menu_items/admin_menu_item_spec.rb
@@ -29,12 +29,13 @@
require 'spec_helper'
RSpec.describe 'Admin menu items',
- js: true,
- with_cuprite: true do
- let(:user) { create(:admin) }
+ :js,
+ :with_cuprite do
+ shared_let(:user) { create(:admin) }
before do
login_as user
+ visit admin_index_path
end
after do
@@ -43,8 +44,6 @@ RSpec.describe 'Admin menu items',
context 'without having any menu items hidden in configuration' do
it 'must display all menu items' do
- visit admin_index_path
-
expect(page).to have_selector('[data-qa-selector="menu-blocks--container"]')
expect(page).to have_selector('[data-qa-selector="menu-block"]', count: 20)
expect(page).to have_selector('[data-qa-selector="op-menu--item-action"]', count: 21) # All plus 'overview'
@@ -56,23 +55,19 @@ RSpec.describe 'Admin menu items',
'hidden_menu_items' => { 'admin_menu' => ['colors'] }
} do
it 'must not display the hidden menu items and blocks' do
- visit admin_index_path
-
expect(page).to have_selector('[data-qa-selector="menu-blocks--container"]')
expect(page).to have_selector('[data-qa-selector="menu-block"]', count: 19)
- expect(page).not_to have_selector('[data-qa-selector="menu-block"]', text: I18n.t('timelines.admin_menu.colors'))
+ expect(page).not_to have_selector('[data-qa-selector="menu-block"]', text: I18n.t(:label_color_plural))
expect(page).to have_selector('[data-qa-selector="op-menu--item-action"]', count: 20) # All plus 'overview'
- expect(page).not_to have_selector('[data-qa-selector="op-menu--item-action"]', text: I18n.t('timelines.admin_menu.colors'))
+ expect(page).not_to have_selector('[data-qa-selector="op-menu--item-action"]', text: I18n.t(:label_color_plural))
end
end
context 'when logged in with a non-admin user with specific admin permissions' do
- let(:user) { create(:user, global_permission: %i[manage_user create_backup]) }
+ shared_let(:user) { create(:user, global_permission: %i[manage_user create_backup]) }
it 'must display only the actions allowed by global permissions' do
- visit admin_index_path
-
expect(page).to have_selector('[data-qa-selector="menu-block"]', text: I18n.t('label_user_plural'))
expect(page).to have_selector('[data-qa-selector="menu-block"]', text: I18n.t('label_backup'))
expect(page).to have_selector('[data-qa-selector="op-menu--item-action"]', text: I18n.t('label_user_plural'))