Add own controller for generic settings page

pull/7949/head
Henriette Dinger 5 years ago
parent cb580268f8
commit 364fdfad48
  1. 37
      app/controllers/project_settings/generic_controller.rb
  2. 7
      app/controllers/project_settings_controller.rb
  3. 4
      app/helpers/project_settings_helper.rb
  4. 0
      app/views/project_settings/generic.html.erb
  5. 2
      config/initializers/menus.rb
  6. 3
      config/routes.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

@ -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

@ -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
},
{

@ -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'

@ -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'

Loading…
Cancel
Save