From 69cdbade428523c90d0f1d94559474dab8677efc Mon Sep 17 00:00:00 2001 From: Henriette Dinger Date: Thu, 4 Jul 2019 10:50:29 +0200 Subject: [PATCH] Add new admin menu node "Budgets" && remove Plugin configure link --- app/controllers/settings_controller.rb | 8 +++++++- app/views/admin/plugins.html.erb | 2 -- config/initializers/menus.rb | 10 ++++++++++ modules/costs/lib/open_project/costs/engine.rb | 5 +++-- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/app/controllers/settings_controller.rb b/app/controllers/settings_controller.rb index 81870fd6f8..2ed5a73a6d 100644 --- a/app/controllers/settings_controller.rb +++ b/app/controllers/settings_controller.rb @@ -33,9 +33,15 @@ class SettingsController < ApplicationController before_action :require_admin - current_menu_item do |controller| + current_menu_item [:index, :edit] do + :settings + end + + current_menu_item :plugin do |controller| plugin = Redmine::Plugin.find(controller.params[:id]) plugin.settings[:menu_item] || :settings + rescue Redmine::PluginNotFound + :settings end def index diff --git a/app/views/admin/plugins.html.erb b/app/views/admin/plugins.html.erb index 0bf5f49044..5459da923c 100644 --- a/app/views/admin/plugins.html.erb +++ b/app/views/admin/plugins.html.erb @@ -36,7 +36,6 @@ See docs/COPYRIGHT.rdoc for more details. - <% @plugins.each do |plugin| %> @@ -53,7 +52,6 @@ See docs/COPYRIGHT.rdoc for more details. <%= h plugin.version %> <% end %> - <%= link_to(l(:button_configure), controller: '/settings', action: 'plugin', id: plugin.id) if plugin.configurable? %> <% end %> diff --git a/config/initializers/menus.rb b/config/initializers/menus.rb index b62936befb..9f11adcd7a 100644 --- a/config/initializers/menus.rb +++ b/config/initializers/menus.rb @@ -261,6 +261,16 @@ Redmine::MenuManager.map :admin_menu do |menu| icon: 'icon2 icon-headset', if: proc { OpenProject::Configuration.ee_manager_visible? } + menu.push :admin_costs, + { controller: '/settings', action: 'plugin', id: :openproject_costs }, + caption: :label_cost_object_plural, + icon: 'icon2 icon-budget' + + menu.push :costs_setting, + { controller: '/settings', action: 'plugin', id: :openproject_costs }, + caption: :label_settings, + parent: :admin_costs + menu.push :admin_backlogs, { controller: '/settings', action: 'plugin', id: :openproject_backlogs }, caption: :label_backlogs, diff --git a/modules/costs/lib/open_project/costs/engine.rb b/modules/costs/lib/open_project/costs/engine.rb index 10f37458e1..2d22bd30fd 100644 --- a/modules/costs/lib/open_project/costs/engine.rb +++ b/modules/costs/lib/open_project/costs/engine.rb @@ -30,7 +30,8 @@ module OpenProject::Costs bundled: true, settings: { default: { 'costs_currency' => 'EUR','costs_currency_format' => '%n %u' }, - partial: 'settings/openproject_costs' + partial: 'settings/openproject_costs', + menu_item: :costs_setting }, name: 'OpenProject Costs' do @@ -66,7 +67,7 @@ module OpenProject::Costs menu :admin_menu, :cost_types, { controller: '/cost_types', action: 'index' }, - icon: 'icon2 icon-cost-types', + parent: :admin_costs, caption: :label_cost_type_plural menu :project_menu,