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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Replace tab content by own pages with own controllers
Henriette Dinger2be6ca186dc2
diff --git a/app/controllers/project_settings/activities_controller.rb b/app/controllers/project_settings/activities_controller.rbnew file mode 100644index 00000000000..fcec1e8e514--- /dev/null+++ b/app/controllers/project_settings/activities_controller.rb@@ -0,0 +1,36 @@+#-- 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::ActivitiesController < ProjectSettingsController+ menu_item :settings_activities++ def show+ render template: 'project_settings/activities'+ end+enddiff --git a/app/controllers/project_settings/categories_controller.rb b/app/controllers/project_settings/categories_controller.rbnew file mode 100644index 00000000000..db1cad9815c--- /dev/null+++ b/app/controllers/project_settings/categories_controller.rb@@ -0,0 +1,36 @@+#-- 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::CategoriesController < ProjectSettingsController+ menu_item :settings_categories++ def show+ render template: 'project_settings/categories'+ end+enddiff --git a/app/controllers/project_settings/custom_fields_controller.rb b/app/controllers/project_settings/custom_fields_controller.rbnew file mode 100644index 00000000000..90aa67e5e61--- /dev/null+++ b/app/controllers/project_settings/custom_fields_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::CustomFieldsController < ProjectSettingsController+ menu_item :settings_custom_fields++ def show+ @wp_custom_fields = WorkPackageCustomField.order("#{CustomField.table_name}.position")+ render template: 'project_settings/custom_fields'+ end+enddiff --git a/app/controllers/project_settings/modules_controller.rb b/app/controllers/project_settings/modules_controller.rbnew file mode 100644index 00000000000..31b67f5ff92--- /dev/null+++ b/app/controllers/project_settings/modules_controller.rb@@ -0,0 +1,36 @@+#-- 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::ModulesController < ProjectSettingsController+ menu_item :settings_modules++ def show+ render template: 'project_settings/modules'+ end+enddiff --git a/app/controllers/project_settings/repositories_controller.rb b/app/controllers/project_settings/repositories_controller.rbnew file mode 100644index 00000000000..5969cb5a4d5--- /dev/null+++ b/app/controllers/project_settings/repositories_controller.rb@@ -0,0 +1,52 @@+#-- 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::RepositoriesController < ProjectSettingsController+ menu_item :settings_repositories++ def show+ @repository = @project.repository || new_repository+ render template: 'repositories/project_settings'+ end++ private++ def new_repository+ return unless params[:scm_vendor]++ service = Scm::RepositoryFactoryService.new(@project, params)+ if service.build_temporary+ @repository = service.repository+ else+ logger.error("Cannot create repository for #{params[:scm_vendor]}")+ flash[:error] = service.build_error+ nil+ end+ end+enddiff --git a/app/controllers/project_settings/types_controller.rb b/app/controllers/project_settings/types_controller.rbnew file mode 100644index 00000000000..ffa581a4e93--- /dev/null+++ b/app/controllers/project_settings/types_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::TypesController < ProjectSettingsController+ menu_item :settings_types++ def show+ @types = ::Type.all+ render template: 'project_settings/types'+ end+enddiff --git a/app/controllers/project_settings/versions_controller.rb b/app/controllers/project_settings/versions_controller.rbnew file mode 100644index 00000000000..416a8892a07--- /dev/null+++ b/app/controllers/project_settings/versions_controller.rb@@ -0,0 +1,36 @@+#-- 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::VersionsController < ProjectSettingsController+ menu_item :settings_versions++ def show+ render template: 'project_settings/versions'+ end+enddiff --git a/app/controllers/project_settings_controller.rb b/app/controllers/project_settings_controller.rbindex 6295545822b..5ea01b9e545 100644--- a/app/controllers/project_settings_controller.rb+++ b/app/controllers/project_settings_controller.rb@@ -28,14 +28,17 @@#++class ProjectSettingsController < ApplicationController- menu_item :settings+ menu_item :settings_infobefore_action :find_projectbefore_action :authorizebefore_action :check_valid_tabbefore_action :get_tab_settings- def show; end+ def show+ @altered_project = @project+ render template: 'project_settings/information'+ endprivatediff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rbindex b26df634530..c2ed507e7e1 100644--- a/app/helpers/projects_helper.rb+++ b/app/helpers/projects_helper.rb@@ -95,6 +95,14 @@ module ProjectsHelpertabs.select { |tab| User.current.allowed_to?(tab[:action], @project) }end+ def settings_project_path(project, opts = {})+ if opts[:tab]+ url_for controller: "project_settings/#{opts[:tab]}", action: 'show', only_path: true, id: project+ else+ url_for controller: "project_settings", action: 'show', only_path: true, id: project+ end+ end+# Returns a set of options for a select field, grouped by project.def version_options_for_select(versions, selected = nil)grouped = Hash.new { |h, k| h[k] = [] }diff --git a/app/views/project_settings/_activities.html.erb b/app/views/project_settings/activities.html.erbsimilarity index 100%rename from app/views/project_settings/_activities.html.erbrename to app/views/project_settings/activities.html.erbdiff --git a/app/views/project_settings/_categories.html.erb b/app/views/project_settings/categories.html.erbsimilarity index 100%rename from app/views/project_settings/_categories.html.erbrename to app/views/project_settings/categories.html.erbdiff --git a/app/views/project_settings/_custom_fields.html.erb b/app/views/project_settings/custom_fields.html.erbsimilarity index 100%rename from app/views/project_settings/_custom_fields.html.erbrename to app/views/project_settings/custom_fields.html.erbdiff --git a/app/views/project_settings/information.html.erb b/app/views/project_settings/information.html.erbnew file mode 100644index 00000000000..93eadec2253--- /dev/null+++ b/app/views/project_settings/information.html.erb@@ -0,0 +1,29 @@+<%#-- 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.++++#%>+<%= render partial: 'projects/edit' %>diff --git a/app/views/project_settings/_modules.html.erb b/app/views/project_settings/modules.html.erbsimilarity index 100%rename from app/views/project_settings/_modules.html.erbrename to app/views/project_settings/modules.html.erbdiff --git a/app/views/project_settings/show.html.erb b/app/views/project_settings/show.html.erbindex cf74184ed02..22f9361f621 100644--- a/app/views/project_settings/show.html.erb+++ b/app/views/project_settings/show.html.erb@@ -27,5 +27,3 @@ See docs/COPYRIGHT.rdoc for more details.++#%><% html_title(l(:label_project_settings)) -%>--<%= render_tabs project_settings_tabs %>diff --git a/app/views/project_settings/_types.html.erb b/app/views/project_settings/types.html.erbsimilarity index 100%rename from app/views/project_settings/_types.html.erbrename to app/views/project_settings/types.html.erbdiff --git a/app/views/project_settings/_versions.html.erb b/app/views/project_settings/versions.html.erbsimilarity index 100%rename from app/views/project_settings/_versions.html.erbrename to app/views/project_settings/versions.html.erbdiff --git a/app/views/repositories/_settings.html.erb b/app/views/repositories/project_settings.html.erbsimilarity index 100%rename from app/views/repositories/_settings.html.erbrename to app/views/repositories/project_settings.html.erbdiff --git a/config/initializers/menus.rb b/config/initializers/menus.rbindex 87837f0cf57..abc55f038c4 100644--- a/config/initializers/menus.rb+++ b/config/initializers/menus.rb@@ -372,37 +372,37 @@ Redmine::MenuManager.map :project_menu do |menu|parent: :settingsmenu.push :settings_modules,- { controller: '/project_settings', action: 'show', tab: :modules },+ { controller: '/project_settings/modules', action: 'show' },caption: :label_modules,parent: :settingsmenu.push :settings_custom_fields,- { controller: '/project_settings', action: 'show', tab: :custom_fields },+ { controller: '/project_settings/custom_fields', action: 'show' },caption: :label_custom_field_plural,parent: :settingsmenu.push :settings_versions,- { controller: '/project_settings', action: 'show', tab: :versions },+ { controller: '/project_settings/versions', action: 'show' },caption: :label_version_plural,parent: :settingsmenu.push :settings_categories,- { controller: '/project_settings', action: 'show', tab: :categories },+ { controller: '/project_settings/categories', action: 'show' },caption: :label_work_package_category_plural,parent: :settingsmenu.push :settings_repositories,- { controller: '/project_settings', action: 'show', tab: :repository },+ { controller: '/project_settings/repositories', action: 'show' },caption: :label_repository,parent: :settingsmenu.push :settings_activities,- { controller: '/project_settings', action: 'show', tab: :activities },+ { controller: '/project_settings/activities', action: 'show'},caption: :enumeration_activities,parent: :settingsmenu.push :settings_types,- { controller: '/project_settings', action: 'show', tab: :types },+ { controller: '/project_settings/types', action: 'show' },caption: :label_work_package_types,parent: :settingsdiff --git a/config/initializers/permissions.rb b/config/initializers/permissions.rbindex 5439f715b1e..baf3d431b70 100644--- a/config/initializers/permissions.rb+++ b/config/initializers/permissions.rb@@ -49,6 +49,13 @@ OpenProject::AccessControl.map do |map|{projects: %i[edit update custom_fields],project_settings: [:show],+ 'project_settings/modules': [:show],+ 'project_settings/custom_fields': [:show],+ 'project_settings/versions': [:show],+ 'project_settings/activities': [:show],+ 'project_settings/categories': [:show],+ 'project_settings/types': [:show],+ 'project_settings/repositories': [:show],members: [:paginate_users]},require: :memberdiff --git a/config/routes.rb b/config/routes.rbindex 5e2635eeb21..29310f2ecba 100644--- a/config/routes.rb+++ b/config/routes.rb@@ -171,7 +171,10 @@ OpenProject::Application.routes.draw do# settings_project_path(@project, tab: 'members')# => "/projects/1/settings/members"#- get 'settings(/:tab)', controller: 'project_settings', action: 'show', as: :settings+ %i(modules categories versions custom_fields types activities repositories).each do |tab|+ get "settings/#{tab}", controller: "project_settings/#{tab}", action: 'show', as: "settings_#{tab}"+ end+ get 'settings', controller: 'project_settings', action: 'show', as: :settingsget 'identifier', action: 'identifier'patch 'identifier', action: 'update_identifier'