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 own controller for generic settings page

Henriette Dinger364fdfad487a
diff --git a/app/controllers/project_settings/generic_controller.rb b/app/controllers/project_settings/generic_controller.rb
new file mode 100644
index 00000000000..640d99dfb81
--- /dev/null
+++ b/app/controllers/project_settings/generic_controller.rb
@@ -0,0 +1,37 @@
+#-- encoding: UTF-8
+#-- copyright
+# OpenProject is a project management system.
+# Copyright (C) 2012-2018 the OpenProject Foundation (OPF)
+#
+# 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-2017 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 docs/COPYRIGHT.rdoc for more details.
+#++
+
+class ProjectSettings::GenericController < ProjectSettingsController
+ menu_item :settings_generic
+
+ def show
+ @altered_project = @project
+ render template: 'project_settings/generic'
+ end
+end
diff --git a/app/controllers/project_settings_controller.rb b/app/controllers/project_settings_controller.rb
index 3d13d94d262..bf668033fcb 100644
--- a/app/controllers/project_settings_controller.rb
+++ b/app/controllers/project_settings_controller.rb
@@ -28,15 +28,10 @@
#++
class ProjectSettingsController < ApplicationController
- menu_item :settings_info
-
before_action :find_project
before_action :authorize
- def show
- @altered_project = @project
- render template: 'project_settings/information'
- end
+ def show; end
private
def find_project
diff --git a/app/helpers/project_settings_helper.rb b/app/helpers/project_settings_helper.rb
index 6224726647a..2427b4a79ad 100644
--- a/app/helpers/project_settings_helper.rb
+++ b/app/helpers/project_settings_helper.rb
@@ -33,8 +33,8 @@ module ProjectSettingsHelper
def project_settings_tabs
tabs = [
{
- name: 'info',
- action: { controller: '/project_settings', action: 'show' },
+ name: 'generic',
+ action: { controller: '/project_settings/generic', action: 'show' },
label: :label_information_plural
},
{
diff --git a/app/views/project_settings/information.html.erb b/app/views/project_settings/generic.html.erb
similarity index 100%
rename from app/views/project_settings/information.html.erb
rename to app/views/project_settings/generic.html.erb
diff --git a/config/initializers/menus.rb b/config/initializers/menus.rb
index f195abe72b4..aa3760d6440 100644
--- a/config/initializers/menus.rb
+++ b/config/initializers/menus.rb
@@ -361,7 +361,7 @@ Redmine::MenuManager.map :project_menu do |menu|
icon: 'icon2 icon-group'
menu.push :settings,
- { controller: '/project_settings', action: 'show' },
+ { controller: '/project_settings/generic', action: 'show' },
caption: :label_project_settings,
last: true,
icon: 'icon2 icon-settings2'
diff --git a/config/routes.rb b/config/routes.rb
index fe7e8cacd34..422836deaee 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -172,11 +172,10 @@ OpenProject::Application.routes.draw do
# => "/projects/1/settings/members"
#
ProjectSettingsHelper.project_settings_tabs.each do |tab|
- next if tab[:name] == 'info'
get "settings/#{tab[:name]}", controller: "project_settings/#{tab[:name]}", action: 'show', as: "settings_#{tab[:name]}"
end
- get 'settings', controller: 'project_settings', action: 'show', as: :settings
+ get 'settings', controller: 'project_settings/generic', action: 'show', as: :settings
get 'identifier', action: 'identifier'
patch 'identifier', action: 'update_identifier'