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

use resouce based routing

ulfertsf89f19dffcfd
diff --git a/app/controllers/categories_controller.rb b/app/controllers/categories_controller.rb
index c7fcd88a336..d426b30265a 100644
--- a/app/controllers/categories_controller.rb
+++ b/app/controllers/categories_controller.rb
@@ -48,7 +48,7 @@ class CategoriesController < ApplicationController
respond_to do |format|
format.html do
flash[:notice] = I18n.t(:notice_successful_create)
- redirect_to categories_settings_project_path(@project)
+ redirect_to project_settings_categories_path(@project)
end
format.js do
render locals: { project: @project, category: @category }
@@ -70,7 +70,7 @@ class CategoriesController < ApplicationController
@category.attributes = permitted_params.category
if @category.save
flash[:notice] = I18n.t(:notice_successful_update)
- redirect_to categories_settings_project_path(@project)
+ redirect_to project_settings_categories_path(@project)
else
render action: 'edit'
end
@@ -81,12 +81,12 @@ class CategoriesController < ApplicationController
if @issue_count == 0
# No issue assigned to this category
@category.destroy
- redirect_to categories_settings_project_path(@project)
+ redirect_to project_settings_categories_path(@project)
return
elsif params[:todo]
reassign_to = @project.categories.find_by(id: params[:reassign_to_id]) if params[:todo] == 'reassign'
@category.destroy(reassign_to)
- redirect_to categories_settings_project_path(@project)
+ redirect_to project_settings_categories_path(@project)
return
end
@categories = @project.categories - [@category]
diff --git a/app/controllers/project_settings_controller.rb b/app/controllers/project_settings_controller.rb
index de71c84cd8a..0a8e7a637b5 100644
--- a/app/controllers/project_settings_controller.rb
+++ b/app/controllers/project_settings_controller.rb
@@ -29,7 +29,7 @@
#++
class ProjectSettingsController < ApplicationController
- before_action :find_project
+ before_action :find_project_by_project_id
before_action :authorize
def show; end
diff --git a/app/controllers/projects/settings/custom_fields_controller.rb b/app/controllers/projects/settings/custom_fields_controller.rb
index 47a565b5851..94b9d467ecc 100644
--- a/app/controllers/projects/settings/custom_fields_controller.rb
+++ b/app/controllers/projects/settings/custom_fields_controller.rb
@@ -46,7 +46,7 @@ class Projects::Settings::CustomFieldsController < ProjectSettingsController
end
end
- redirect_to custom_fields_settings_project_path(@project)
+ redirect_to project_settings_custom_fields_path(@project)
end
private
diff --git a/app/controllers/projects/settings/modules_controller.rb b/app/controllers/projects/settings/modules_controller.rb
index f8cae5f0793..c45dd1eaedd 100644
--- a/app/controllers/projects/settings/modules_controller.rb
+++ b/app/controllers/projects/settings/modules_controller.rb
@@ -39,7 +39,7 @@ class Projects::Settings::ModulesController < ProjectSettingsController
if call.success?
flash[:notice] = I18n.t(:notice_successful_update)
- redirect_to modules_settings_project_path(@project)
+ redirect_to project_settings_modules_path(@project)
else
@errors = call.errors
render 'show'
diff --git a/app/controllers/projects/settings/types_controller.rb b/app/controllers/projects/settings/types_controller.rb
index 90a6ae4e4ca..5edeb55296d 100644
--- a/app/controllers/projects/settings/types_controller.rb
+++ b/app/controllers/projects/settings/types_controller.rb
@@ -42,6 +42,6 @@ class Projects::Settings::TypesController < ProjectSettingsController
flash[:error] = @project.errors.full_messages
end
- redirect_to types_settings_project_path(@project.identifier)
+ redirect_to project_settings_types_path(@project.identifier)
end
end
diff --git a/app/controllers/projects/templated_controller.rb b/app/controllers/projects/templated_controller.rb
index 8c286557a2d..ef8a2cced34 100644
--- a/app/controllers/projects/templated_controller.rb
+++ b/app/controllers/projects/templated_controller.rb
@@ -29,7 +29,7 @@
#++
class Projects::TemplatedController < ApplicationController
- before_action :find_project
+ before_action :find_project_by_project_id
before_action :authorize
def create
@@ -50,7 +50,7 @@ class Projects::TemplatedController < ApplicationController
if service_call.success?
flash[:notice] = t(:notice_successful_update)
- redirect_to general_settings_project_path(@project)
+ redirect_to project_settings_general_path(@project)
else
@errors = service_call.errors
render template: 'projects/settings/general'
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 515e6170693..5dff8b311d8 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -77,7 +77,7 @@ class ProjectsController < ApplicationController
if service_call.success?
flash[:notice] = I18n.t(:notice_successful_update)
- redirect_to general_settings_project_path(@project)
+ redirect_to project_settings_general_path(@project)
else
render action: 'identifier'
end
diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb
index 9cbd87f99e7..fa54b815e61 100644
--- a/app/controllers/repositories_controller.rb
+++ b/app/controllers/repositories_controller.rb
@@ -58,7 +58,7 @@ class RepositoriesController < ApplicationController
@repository = @project.repository
update_repository(params.fetch(:repository, {}))
- redirect_to repository_settings_project_path(@project)
+ redirect_to project_settings_repository_path(@project)
end
def create
@@ -71,7 +71,7 @@ class RepositoriesController < ApplicationController
flash[:error] = service.build_error
end
- redirect_to repository_settings_project_path(@project)
+ redirect_to project_settings_repository_path(@project)
end
def committers
@@ -95,7 +95,7 @@ class RepositoriesController < ApplicationController
def destroy_info
@repository = @project.repository
- repository_settings_project_path(@project)
+ project_settings_repository_path(@project)
end
def destroy
@@ -105,7 +105,7 @@ class RepositoriesController < ApplicationController
else
flash[:error] = repository.errors.full_messages
end
- redirect_to repository_settings_project_path(@project)
+ redirect_to project_settings_repository_path(@project)
end
def show
diff --git a/app/controllers/versions_controller.rb b/app/controllers/versions_controller.rb
index 01711fd5e88..a4d331018b6 100644
--- a/app/controllers/versions_controller.rb
+++ b/app/controllers/versions_controller.rb
@@ -97,7 +97,7 @@ class VersionsController < ApplicationController
if request.put?
@project.close_completed_versions
end
- redirect_to versions_settings_project_path(@project)
+ redirect_to project_settings_versions_path(@project)
end
def destroy
@@ -110,13 +110,13 @@ class VersionsController < ApplicationController
flash[:error] = call.errors.full_messages
end
- redirect_to versions_settings_project_path(@project)
+ redirect_to project_settings_versions_path(@project)
end
private
def redirect_back_or_version_settings
- redirect_back_or_default(versions_settings_project_path(@project))
+ redirect_back_or_default(project_settings_versions_path(@project))
end
def find_project
diff --git a/app/helpers/project_settings_helper.rb b/app/helpers/project_settings_helper.rb
deleted file mode 100644
index b1c29d9e5a4..00000000000
--- a/app/helpers/project_settings_helper.rb
+++ /dev/null
@@ -1,88 +0,0 @@
-#-- encoding: UTF-8
-
-#-- copyright
-# OpenProject is an open source project management software.
-# Copyright (C) 2012-2021 the OpenProject GmbH
-#
-# 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-2013 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 COPYRIGHT and LICENSE files for more details.
-#++
-
-module ProjectSettingsHelper
- extend self
- def project_settings_tabs
- [
- {
- name: 'general',
- action: { controller: '/projects/settings/general', action: 'show' },
- label: :label_information_plural
- },
- {
- name: 'modules',
- action: { controller: '/projects/settings/modules', action: 'show' },
- label: :label_module_plural
- },
- {
- name: 'types',
- action: { controller: '/projects/settings/types', action: 'show' },
- label: :label_work_package_types
- },
- {
- name: 'custom_fields',
- action: { controller: '/projects/settings/custom_fields', action: 'show' },
- label: :label_custom_field_plural
- },
- {
- name: 'versions',
- action: { controller: '/projects/settings/versions', action: 'show' },
- label: :label_version_plural
- },
- {
- name: 'categories',
- action: { controller: '/projects/settings/categories', action: 'show' },
- label: :label_work_package_category_plural,
- last: true
- },
- {
- name: 'repository',
- action: { controller: '/projects/settings/repository', action: 'show' },
- label: :label_repository
- },
- {
- name: 'time_entry_activities',
- action: { controller: '/projects/settings/time_entry_activities', action: 'show' },
- label: :enumeration_activities
- },
- {
- name: :backlogs,
- action: { controller: '/projects/settings/backlogs', action: 'show' },
- label: :label_backlogs,
- },
- {
- name: 'storage',
- action: { controller: '/projects/settings/storage', action: 'show' },
- label: :label_required_disk_storage
- }
- ]
- end
-end
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index b6590244b91..f5edca5ffe7 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -87,7 +87,7 @@ module ProjectsHelper
def project_more_menu_settings_item(project)
if User.current.allowed_to?({ controller: '/projects/settings/general', action: 'show' }, project)
[t(:label_project_settings),
- general_settings_project_path(project),
+ project_settings_general_path(project),
{ class: 'icon-context icon-settings',
title: t(:label_project_settings) }]
end
diff --git a/app/views/projects/_toolbar.html.erb b/app/views/projects/_toolbar.html.erb
index 1e72290c867..d5224b1ff0a 100644
--- a/app/views/projects/_toolbar.html.erb
+++ b/app/views/projects/_toolbar.html.erb
@@ -66,7 +66,7 @@ See COPYRIGHT and LICENSE files for more details.
</li>
<li class="toolbar-item hidden-for-mobile">
<% label = @project.templated ? 'remove_from_templates' : 'make_template' %>
- <%= link_to(templated_project_path(@project),
+ <%= link_to(project_templated_path(@project),
method: @project.templated ? :delete : :post,
title: t("project.template.#{label}"),
class: 'button') do %>
diff --git a/app/views/projects/identifier.html.erb b/app/views/projects/identifier.html.erb
index a2e5b72b5ab..c5668f08be7 100644
--- a/app/views/projects/identifier.html.erb
+++ b/app/views/projects/identifier.html.erb
@@ -50,7 +50,7 @@ See COPYRIGHT and LICENSE files for more details.
<%= f.submit t(:button_update), class: 'button -highlight -with-icon icon-checkmark' %>
</span>
<span>
- <%= link_to general_settings_project_path(@project), class: 'button' do %>
+ <%= link_to project_settings_general_path(@project), class: 'button' do %>
<%= op_icon('button--icon icon-cancel') %>
<span class="button--text"><%= t(:button_cancel) %></span>
<% end %>
diff --git a/app/views/projects/settings/custom_fields/show.html.erb b/app/views/projects/settings/custom_fields/show.html.erb
index fc386e45755..5095637b729 100644
--- a/app/views/projects/settings/custom_fields/show.html.erb
+++ b/app/views/projects/settings/custom_fields/show.html.erb
@@ -45,7 +45,7 @@ See COPYRIGHT and LICENSE files for more details.
<% if @wp_custom_fields.any? %>
<%= labelled_tabular_form_for @project,
- url: custom_fields_settings_project_path(@project),
+ url: project_settings_custom_fields_path(@project),
html: { id: 'modules-form' } do |form| %>
<%= render partial: 'form',
diff --git a/app/views/projects/settings/modules/show.html.erb b/app/views/projects/settings/modules/show.html.erb
index 820e54bf03e..dfb13a44076 100644
--- a/app/views/projects/settings/modules/show.html.erb
+++ b/app/views/projects/settings/modules/show.html.erb
@@ -34,7 +34,7 @@ See COPYRIGHT and LICENSE files for more details.
<%= error_messages_for_contract(@project, @errors) %>
<%= labelled_tabular_form_for @project,
- url: modules_settings_project_path(@project) do |form| %>
+ url: project_settings_modules_path(@project) do |form| %>
<%= render partial: "form",
locals: { form: form } %>
diff --git a/app/views/projects/settings/types/show.html.erb b/app/views/projects/settings/types/show.html.erb
index d138a4aeab9..20dee72b751 100644
--- a/app/views/projects/settings/types/show.html.erb
+++ b/app/views/projects/settings/types/show.html.erb
@@ -33,7 +33,7 @@ See COPYRIGHT and LICENSE files for more details.
<% if Type.any? %>
<%= form_for @project,
- url: types_settings_project_path(@project),
+ url: project_settings_types_path(@project),
method: :patch,
html: { id: 'types-form' } do |f| %>
<%= render partial: 'form',
diff --git a/app/views/repositories/_repository_header.html.erb b/app/views/repositories/_repository_header.html.erb
index 214b360e6b6..97eed2d45b6 100644
--- a/app/views/repositories/_repository_header.html.erb
+++ b/app/views/repositories/_repository_header.html.erb
@@ -73,7 +73,7 @@ See COPYRIGHT and LICENSE files for more details.
{ repository: @repository, project: @project, repository_empty: empty }) %>
<% if User.current.allowed_to?(:manage_repository, @project) %>
<li class="toolbar-item -icon-only">
- <%= link_to repository_settings_project_path(@project),
+ <%= link_to project_settings_repository_path(@project),
class: 'button', title: t(:label_setting_plural) do %>
<%= op_icon('button--icon icon-settings') %>
<% end %>
diff --git a/app/views/repositories/committers.html.erb b/app/views/repositories/committers.html.erb
index 75f25b761af..f85ef11fd79 100644
--- a/app/views/repositories/committers.html.erb
+++ b/app/views/repositories/committers.html.erb
@@ -81,7 +81,7 @@ See COPYRIGHT and LICENSE files for more details.
<hr class="form--separator" />
<p>
<%= submit_tag t(:button_update), class: 'button -highlight' %>
- <%= link_to repository_settings_project_path(@project.id), class: 'button' do %>
+ <%= link_to project_settings_repository_path(@project.id), class: 'button' do %>
<span class="button--text"><%= t(:button_cancel) %></span>
<% end %>
</p>
diff --git a/app/views/repositories/destroy_info.html.erb b/app/views/repositories/destroy_info.html.erb
index 01f193c0da7..72ea284de83 100644
--- a/app/views/repositories/destroy_info.html.erb
+++ b/app/views/repositories/destroy_info.html.erb
@@ -55,7 +55,7 @@ See COPYRIGHT and LICENSE files for more details.
<%= op_icon('button--icon icon-delete') %>
<span class="button--text"><%= t(:button_delete) %></span>
<% end %>
- <%= link_to repository_settings_project_path(@project),
+ <%= link_to project_settings_repository_path(@project),
title: t(:button_cancel),
class: 'button -with-icon icon-cancel' do %>
<%= t(:button_cancel) %>
@@ -84,7 +84,7 @@ See COPYRIGHT and LICENSE files for more details.
<%= op_icon('button--icon icon-remove') %>
<span class="button--text"><%= t(:button_remove) %></span>
<% end %>
- <%= link_to repository_settings_project_path(@project),
+ <%= link_to project_settings_repository_path(@project),
title: t(:button_cancel),
class: 'button -with-icon icon-cancel' do %>
<%= t(:button_cancel) %>
diff --git a/config/initializers/menus.rb b/config/initializers/menus.rb
index 94384bcf673..bf83fc577eb 100644
--- a/config/initializers/menus.rb
+++ b/config/initializers/menus.rb
@@ -480,12 +480,20 @@ Redmine::MenuManager.map :project_menu do |menu|
icon: 'icon2 icon-settings2',
allow_deeplink: true
- ProjectSettingsHelper.project_settings_tabs.each do |node|
- menu.push :"settings_#{node[:name]}",
- node[:action],
- caption: node[:label],
- parent: :settings,
- last: node[:last],
- if: node[:if]
+ {
+ general: :label_information_plural,
+ modules: :label_module_plural,
+ types: :label_work_package_types,
+ custom_fields: :label_custom_field_plural,
+ versions: :label_version_plural,
+ categories: :label_work_package_category_plural,
+ repository: :label_repository,
+ time_entry_activities: :enumeration_activities,
+ storage: :label_required_disk_storage
+ }.each do |key, caption|
+ menu.push :"settings_#{key}",
+ { controller: "/projects/settings/#{key}", action: 'show' },
+ caption: caption,
+ parent: :settings
end
end
diff --git a/config/routes.rb b/config/routes.rb
index e4c049f9094..f45553716f6 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -176,25 +176,22 @@ OpenProject::Application.routes.draw do
end
resources :projects, except: %i[show edit create update] do
- member do
- scope module: 'projects' do
- post :templated, controller: 'templated', action: :create
- delete :templated, controller: 'templated', action: :destroy
-
- namespace 'settings' do
- ProjectSettingsHelper
- .project_settings_tabs
- .each do |tab|
- get tab[:name],
- controller: tab[:name],
- action: :show
- patch tab[:name],
- controller: tab[:name],
- action: :update
- end
- end
+ scope module: 'projects' do
+ namespace 'settings' do
+ resource :general, only: %i[show], controller: 'general'
+ resource :modules, only: %i[show update]
+ resource :types, only: %i[show update]
+ resource :custom_fields, only: %i[show update]
+ resource :repository, only: %i[show], controller: 'repository'
+ resource :versions, only: %i[show]
+ resource :categories, only: %i[show update]
+ resource :storage, only: %i[show], controller: 'storage'
end
+ resource :templated, only: %i[create destroy], controller: 'templated'
+ end
+
+ member do
get "settings", to: redirect('projects/%{id}/settings/general/') # rubocop:disable Style/FormatStringToken
get 'identifier', action: 'identifier'
diff --git a/lib/api/v3/work_packages/create_form_representer.rb b/lib/api/v3/work_packages/create_form_representer.rb
index 54ba13ddba0..6f15dc74f89 100644
--- a/lib/api/v3/work_packages/create_form_representer.rb
+++ b/lib/api/v3/work_packages/create_form_representer.rb
@@ -72,7 +72,7 @@ module API
current_user_allowed_to(:edit_project,
context: represented.project))
{
- href: custom_fields_settings_project_path(represented.project.identifier),
+ href: project_settings_custom_fields_path(represented.project.identifier),
type: 'text/html',
title: I18n.t('label_custom_field_plural')
}
diff --git a/lib/api/v3/work_packages/create_project_form_representer.rb b/lib/api/v3/work_packages/create_project_form_representer.rb
index 521d303670b..5fb81dd5589 100644
--- a/lib/api/v3/work_packages/create_project_form_representer.rb
+++ b/lib/api/v3/work_packages/create_project_form_representer.rb
@@ -69,7 +69,7 @@ module API
current_user_allowed_to(:edit_project,
context: represented.project)
{
- href: custom_fields_settings_project_path(represented.project.identifier),
+ href: project_settings_custom_fields_path(represented.project.identifier),
type: 'text/html',
title: I18n.t('label_custom_field_plural')
}
diff --git a/lib/api/v3/work_packages/work_package_collection_representer.rb b/lib/api/v3/work_packages/work_package_collection_representer.rb
index 269e9576070..e3832fa112d 100644
--- a/lib/api/v3/work_packages/work_package_collection_representer.rb
+++ b/lib/api/v3/work_packages/work_package_collection_representer.rb
@@ -115,7 +115,7 @@ module API
if project.present? &&
(current_user.try(:admin?) || current_user_allowed_to(:edit_project, context: project))
{
- href: custom_fields_settings_project_path(project.identifier),
+ href: project_settings_custom_fields_path(project.identifier),
type: 'text/html',
title: I18n.t('label_custom_field_plural')
}
diff --git a/lib/api/v3/work_packages/work_package_representer.rb b/lib/api/v3/work_packages/work_package_representer.rb
index 39b4564d581..7263f35c910 100644
--- a/lib/api/v3/work_packages/work_package_representer.rb
+++ b/lib/api/v3/work_packages/work_package_representer.rb
@@ -147,7 +147,7 @@ module API
next if represented.project.nil?
{
- href: custom_fields_settings_project_path(represented.project.identifier),
+ href: project_settings_custom_fields_path(represented.project.identifier),
type: 'text/html',
title: "Custom fields"
}
diff --git a/modules/backlogs/app/controllers/projects/settings/backlogs_controller.rb b/modules/backlogs/app/controllers/projects/settings/backlogs_controller.rb
index 48b97838577..95a14a7c8c7 100644
--- a/modules/backlogs/app/controllers/projects/settings/backlogs_controller.rb
+++ b/modules/backlogs/app/controllers/projects/settings/backlogs_controller.rb
@@ -64,7 +64,7 @@ class Projects::Settings::BacklogsController < ProjectSettingsController
private
def redirect_to_backlogs_settings
- redirect_to backlogs_settings_project_path(@project)
+ redirect_to project_settings_backlogs_path(@project)
end
def log_rebuild_position_error
diff --git a/modules/backlogs/app/views/projects/settings/backlogs/show.html.erb b/modules/backlogs/app/views/projects/settings/backlogs/show.html.erb
index 905f00e75b6..c6722254978 100644
--- a/modules/backlogs/app/views/projects/settings/backlogs/show.html.erb
+++ b/modules/backlogs/app/views/projects/settings/backlogs/show.html.erb
@@ -31,7 +31,7 @@ See COPYRIGHT and LICENSE files for more details.
<%= render partial: 'projects/settings/form_toolbar', locals: { form_name: "edit_project_#{@project.id}" } %>
<% end %>
-<%= styled_form_tag(backlogs_settings_project_path(@project),
+<%= styled_form_tag(project_settings_backlogs_path(@project),
method: :patch,
id: "edit_project_#{@project.id}") do %>
diff --git a/modules/backlogs/config/routes.rb b/modules/backlogs/config/routes.rb
index 235403eb63c..3b14907345c 100644
--- a/modules/backlogs/config/routes.rb
+++ b/modules/backlogs/config/routes.rb
@@ -55,8 +55,17 @@ OpenProject::Application.routes.draw do
end
end
+ scope 'projects/:project_id', as: 'project', module: 'projects' do
+ namespace 'settings' do
+ resource :backlogs, only: %i[show update] do
+ member do
+ post 'rebuild_positions' => 'backlogs#rebuild_positions'
+ end
+ end
+ end
+ end
+
get 'projects/:project_id/versions/:id/edit' => 'version_settings#edit'
- post 'projects/:id/settings/rebuild_positions' => 'projects/settings/backlogs#rebuild_positions'
scope 'admin' do
resource :backlogs,
diff --git a/modules/backlogs/lib/open_project/backlogs/engine.rb b/modules/backlogs/lib/open_project/backlogs/engine.rb
index d8e7b53a01f..e097ecb7527 100644
--- a/modules/backlogs/lib/open_project/backlogs/engine.rb
+++ b/modules/backlogs/lib/open_project/backlogs/engine.rb
@@ -97,7 +97,7 @@ module OpenProject::Backlogs
permission :update_sprints,
{
rb_sprints: %i[edit update],
- rb_wikis: %i[edit update],
+ rb_wikis: %i[edit update]
},
require: :member
end
@@ -109,6 +109,13 @@ module OpenProject::Backlogs
before: :calendar,
param: :project_id,
icon: 'icon2 icon-backlogs'
+
+ menu :project_menu,
+ :settings_backlogs,
+ { controller: '/projects/settings/backlogs', action: :show },
+ caption: :label_backlogs,
+ parent: :settings,
+ before: :settings_storage
end
# We still override version and project settings views from the core! URH
diff --git a/modules/backlogs/spec/controllers/versions_controller_spec.rb b/modules/backlogs/spec/controllers/versions_controller_spec.rb
index 36a0a48fc0f..d6304866e93 100644
--- a/modules/backlogs/spec/controllers/versions_controller_spec.rb
+++ b/modules/backlogs/spec/controllers/versions_controller_spec.rb
@@ -70,7 +70,7 @@ describe VersionsController, type: :controller do
patch 'update', params: @params
version.reload
- expect(response).to redirect_to versions_settings_project_path(other_project)
+ expect(response).to redirect_to project_settings_versions_path(other_project)
expect(version.name).to eq(@oldVersionName)
end
@@ -79,7 +79,7 @@ describe VersionsController, type: :controller do
patch 'update', params: @params
version.reload
- expect(response).to redirect_to versions_settings_project_path(version.project)
+ expect(response).to redirect_to project_settings_versions_path(version.project)
expect(version.name).to eq(@newVersionName)
end
end
diff --git a/modules/boards/spec/features/action_boards/version_board_spec.rb b/modules/boards/spec/features/action_boards/version_board_spec.rb
index 43ac104303c..75256d5f8d8 100644
--- a/modules/boards/spec/features/action_boards/version_board_spec.rb
+++ b/modules/boards/spec/features/action_boards/version_board_spec.rb
@@ -228,7 +228,7 @@ describe 'Version action board', type: :feature, js: true do
board_page.add_list_with_new_value 'Completely new version'
board_page.expect_list 'Completely new version'
- visit versions_settings_project_path(project)
+ visit project_settings_versions_path(project)
expect(page).to have_content 'Completely new version'
expect(page).to have_content 'Closed version'
diff --git a/modules/costs/app/controllers/projects/settings/time_entry_activities_controller.rb b/modules/costs/app/controllers/projects/settings/time_entry_activities_controller.rb
index e9c536e15cc..72ad86b2da0 100644
--- a/modules/costs/app/controllers/projects/settings/time_entry_activities_controller.rb
+++ b/modules/costs/app/controllers/projects/settings/time_entry_activities_controller.rb
@@ -35,7 +35,7 @@ class Projects::Settings::TimeEntryActivitiesController < ProjectSettingsControl
TimeEntryActivitiesProject.upsert_all(update_params, unique_by: %i[project_id activity_id])
flash[:notice] = t(:notice_successful_update)
- redirect_to time_entry_activities_settings_project_path(@project)
+ redirect_to project_settings_time_entry_activities_path(@project)
end
private
diff --git a/modules/costs/app/views/projects/settings/time_entry_activities/show.html.erb b/modules/costs/app/views/projects/settings/time_entry_activities/show.html.erb
index 58f97788b6d..1d9ead44dc7 100644
--- a/modules/costs/app/views/projects/settings/time_entry_activities/show.html.erb
+++ b/modules/costs/app/views/projects/settings/time_entry_activities/show.html.erb
@@ -32,7 +32,7 @@ See COPYRIGHT and LICENSE files for more details.
<% if TimeEntryActivity.any? %>
<%= labelled_tabular_form_for @project,
- url: time_entry_activities_settings_project_path(@project) do %>
+ url: project_settings_time_entry_activities_path(@project) do %>
<%= render partial: '/projects/settings/time_entry_activities/activities',
locals: { project: @project } %>
diff --git a/modules/costs/config/routes.rb b/modules/costs/config/routes.rb
index 7dfdbb2b9e8..70e88af915e 100644
--- a/modules/costs/config/routes.rb
+++ b/modules/costs/config/routes.rb
@@ -35,6 +35,12 @@ OpenProject::Application.routes.draw do
end
end
+ scope 'projects/:project_id', as: 'project', module: 'projects' do
+ namespace 'settings' do
+ resource :time_entry_activities, only: %i[show update]
+ end
+ end
+
scope 'work_packages/:work_package_id', as: 'work_packages' do
resources :cost_entries, controller: 'costlog', only: %i[new]
end
diff --git a/modules/costs/spec/features/time_entry/activity_spec.rb b/modules/costs/spec/features/time_entry/activity_spec.rb
index 1734376a5cb..addb7b76b50 100644
--- a/modules/costs/spec/features/time_entry/activity_spec.rb
+++ b/modules/costs/spec/features/time_entry/activity_spec.rb
@@ -50,7 +50,7 @@ describe 'Time entry activity', type: :feature do
expect(page)
.to have_content('A new activity')
- visit general_settings_project_path(project)
+ visit project_settings_general_path(project)
click_on "Time tracking activities"
diff --git a/spec/controllers/versions_controller_spec.rb b/spec/controllers/versions_controller_spec.rb
index 564fe8fd6a2..4574d3dc4c2 100644
--- a/spec/controllers/versions_controller_spec.rb
+++ b/spec/controllers/versions_controller_spec.rb
@@ -197,7 +197,7 @@ describe VersionsController, type: :controller do
post :create, params: { project_id: project.id, version: { name: 'test_add_version' } }
end
- it { expect(response).to redirect_to(versions_settings_project_path(project)) }
+ it { expect(response).to redirect_to(project_settings_versions_path(project)) }
it 'generates the new version' do
version = Version.find_by(name: 'test_add_version')
@@ -231,7 +231,7 @@ describe VersionsController, type: :controller do
put :close_completed, params: { project_id: project.id }
end
- it { expect(response).to redirect_to(versions_settings_project_path(project)) }
+ it { expect(response).to redirect_to(project_settings_versions_path(project)) }
it { expect(Version.find_by(status: 'closed')).to eq(version3) }
end
@@ -251,7 +251,7 @@ describe VersionsController, type: :controller do
patch :update, params: params
end
- it { expect(response).to redirect_to(versions_settings_project_path(project)) }
+ it { expect(response).to redirect_to(project_settings_versions_path(project)) }
it { expect(Version.find_by(name: 'New version name')).to eq(version1) }
it { expect(version1.reload.effective_date).to eq(Date.today) }
end
@@ -297,7 +297,7 @@ describe VersionsController, type: :controller do
end
it 'redirects to projects versions and the version is deleted' do
- expect(response).to redirect_to(versions_settings_project_path(project))
+ expect(response).to redirect_to(project_settings_versions_path(project))
expect { Version.find(@deleted) }.to raise_error ActiveRecord::RecordNotFound
end
end
diff --git a/spec/features/categories/categories_page.rb b/spec/features/categories/categories_page.rb
index 7cfb7b2698e..584b9c3eb7a 100644
--- a/spec/features/categories/categories_page.rb
+++ b/spec/features/categories/categories_page.rb
@@ -35,6 +35,6 @@ class CategoriesPage
end
def visit_settings
- visit(categories_settings_project_path(@project))
+ visit(project_settings_categories_path(@project))
end
end
diff --git a/spec/features/global_roles/no_module_spec.rb b/spec/features/global_roles/no_module_spec.rb
index b4bb7c5d4f0..81458778ea4 100644
--- a/spec/features/global_roles/no_module_spec.rb
+++ b/spec/features/global_roles/no_module_spec.rb
@@ -49,7 +49,7 @@ describe 'Global role: No module', type: :feature, js: true do
# And I am already admin
# When I go to the modules tab of the settings page for the project "test"
# Then I should not see "Global"
- visit modules_settings_project_path(project)
+ visit project_settings_modules_path(project)
expect(page).to have_text 'Activity'
expect(page).to have_no_text 'Foo'
diff --git a/spec/features/menu_items/menu_permissions_spec.rb b/spec/features/menu_items/menu_permissions_spec.rb
index d138c2469f7..0485b9914cb 100644
--- a/spec/features/menu_items/menu_permissions_spec.rb
+++ b/spec/features/menu_items/menu_permissions_spec.rb
@@ -43,7 +43,7 @@ describe 'menu permissions', type: :feature, js: true do
login_as(admin)
# Allowed to see the settings version page
- visit versions_settings_project_path(project)
+ visit project_settings_versions_path(project)
end
it 'I can see all menu entries' do
@@ -67,7 +67,7 @@ describe 'menu permissions', type: :feature, js: true do
login_as(user)
# Allowed to see the settings version page
- visit versions_settings_project_path(project)
+ visit project_settings_versions_path(project)
end
it 'I can only see the version settings page' do
@@ -82,7 +82,7 @@ describe 'menu permissions', type: :feature, js: true do
# Clicking the menu parent item leads to the version page
find('.main-menu--parent-node', text: 'Project settings').click
- expect(page).to have_current_path(versions_settings_project_path(project))
+ expect(page).to have_current_path(project_settings_versions_path(project))
end
end
end
diff --git a/spec/features/projects/edit_settings_spec.rb b/spec/features/projects/edit_settings_spec.rb
index fc52c159061..fac79775887 100644
--- a/spec/features/projects/edit_settings_spec.rb
+++ b/spec/features/projects/edit_settings_spec.rb
@@ -44,7 +44,7 @@ describe 'Projects', 'editing settings', type: :feature, js: true do
end
it 'hides the field whose functionality is presented otherwise' do
- visit general_settings_project_path(project.id)
+ visit project_settings_general_path(project.id)
expect(page).to have_no_text :all, 'Active'
expect(page).to have_no_text :all, 'Identifier'
@@ -99,7 +99,7 @@ describe 'Projects', 'editing settings', type: :feature, js: true do
project.custom_field_values.last.value = 'FOO'
project.save!
- visit general_settings_project_path(project.id)
+ visit project_settings_general_path(project.id)
expect(page).to have_text 'Optional Foo'
expect(page).to have_text 'Required Foo'
@@ -118,7 +118,7 @@ describe 'Projects', 'editing settings', type: :feature, js: true do
let(:foo_field) { ::FormFields::InputFormField.new required_custom_field }
it 'shows the errors of that field when saving (Regression #33766)' do
- visit general_settings_project_path(project.id)
+ visit project_settings_general_path(project.id)
expect(page).to have_content 'Foo'
@@ -141,7 +141,7 @@ describe 'Projects', 'editing settings', type: :feature, js: true do
let(:form_field) { ::FormFields::SelectFormField.new list_custom_field }
it 'can select multiple values' do
- visit general_settings_project_path(project.id)
+ visit project_settings_general_path(project.id)
form_field.select_option 'A', 'B'
@@ -162,7 +162,7 @@ describe 'Projects', 'editing settings', type: :feature, js: true do
let(:form_field) { ::FormFields::InputFormField.new date_custom_field }
it 'can save and remove the date (Regression #37459)' do
- visit general_settings_project_path(project.id)
+ visit project_settings_general_path(project.id)
form_field.set_value '2021-05-26'
form_field.send_keys :escape
@@ -189,7 +189,7 @@ describe 'Projects', 'editing settings', type: :feature, js: true do
end
it 'can update the project without destroying the relation to the parent' do
- visit general_settings_project_path(project.id)
+ visit project_settings_general_path(project.id)
fill_in 'Name', with: 'New project name'
diff --git a/spec/features/projects/project_status_administration_spec.rb b/spec/features/projects/project_status_administration_spec.rb
index 374f221ba3b..99c047361ff 100644
--- a/spec/features/projects/project_status_administration_spec.rb
+++ b/spec/features/projects/project_status_administration_spec.rb
@@ -73,7 +73,7 @@ describe 'Projects status administration', type: :feature, js: true do
expect(page).to have_current_path /projects\/new-project\/?/
# Check that the status has been set correctly
- visit general_settings_project_path(id: 'new-project')
+ visit project_settings_general_path(id: 'new-project')
status_field.expect_selected 'ON TRACK'
status_description.expect_value 'Everything is fine at the start'
diff --git a/spec/features/projects/projects_custom_fields_spec.rb b/spec/features/projects/projects_custom_fields_spec.rb
index 880021ad22a..146bf8be6a8 100644
--- a/spec/features/projects/projects_custom_fields_spec.rb
+++ b/spec/features/projects/projects_custom_fields_spec.rb
@@ -92,7 +92,7 @@ describe 'Projects custom fields', type: :feature, js: true do
expect(page).to have_current_path /\/projects\/my-project-name\/?/
created_project = Project.last
- visit general_settings_project_path(created_project)
+ visit project_settings_general_path(created_project)
default_int_field.expect_value default_int_custom_field.default_value.to_s
default_string_field.expect_value 'Overwritten'
@@ -107,7 +107,7 @@ describe 'Projects custom fields', type: :feature, js: true do
let(:editor) { ::Components::WysiwygEditor.new "[data-qa-field-name='customField#{custom_field.id}']" }
scenario 'allows settings the project boolean CF (regression #26313)' do
- visit general_settings_project_path(project.id)
+ visit project_settings_general_path(project.id)
# expect CF, description and status description ckeditor-augmented-textarea
expect(page).to have_selector('.op-ckeditor--wrapper', count: 3)
@@ -156,7 +156,7 @@ describe 'Projects custom fields', type: :feature, js: true do
cv = project.custom_values.find_by(custom_field_id: float_cf.id).typed_value
expect(cv).to eq 10000.55
- visit general_settings_project_path(project)
+ visit project_settings_general_path(project)
float_field.expect_value '10000.55'
end
end
@@ -181,7 +181,7 @@ describe 'Projects custom fields', type: :feature, js: true do
cv = project.custom_values.find_by(custom_field_id: float_cf.id).typed_value
expect(cv).to eq 10000.55
- visit general_settings_project_path(project)
+ visit project_settings_general_path(project)
# The field renders in german locale, but there's no way to test that
# as the internal value is always english locale
float_field.expect_value '10000.55'
@@ -195,7 +195,7 @@ describe 'Projects custom fields', type: :feature, js: true do
end
scenario 'allows settings the project boolean CF (regression #26313)' do
- visit general_settings_project_path(project.id)
+ visit project_settings_general_path(project.id)
field = page.find(identifier)
expect(field).not_to be_checked
diff --git a/spec/features/projects/subproject_creation_spec.rb b/spec/features/projects/subproject_creation_spec.rb
index cb875e24cd6..1fcb038c866 100644
--- a/spec/features/projects/subproject_creation_spec.rb
+++ b/spec/features/projects/subproject_creation_spec.rb
@@ -49,7 +49,7 @@ describe 'Subproject creation', type: :feature, js: true do
end
before do
- visit general_settings_project_path(parent_project)
+ visit project_settings_general_path(parent_project)
end
it 'can create a subproject' do
diff --git a/spec/features/projects/template_spec.rb b/spec/features/projects/template_spec.rb
index e8b3a21fe99..7620ac51ccb 100644
--- a/spec/features/projects/template_spec.rb
+++ b/spec/features/projects/template_spec.rb
@@ -38,7 +38,7 @@ describe 'Project templates', type: :feature, js: true do
end
it 'can make the project a template from settings' do
- visit general_settings_project_path(project)
+ visit project_settings_general_path(project)
# Make a template
find('.button', text: 'Set as template').click
diff --git a/spec/features/repositories/repository_settings_page.rb b/spec/features/repositories/repository_settings_page.rb
index dae55fad655..4c695826cf1 100644
--- a/spec/features/repositories/repository_settings_page.rb
+++ b/spec/features/repositories/repository_settings_page.rb
@@ -35,6 +35,6 @@ class RepositorySettingsPage
end
def visit_repository_settings
- visit repository_settings_project_path(@project.id)
+ visit project_settings_repository_path(@project.id)
end
end
diff --git a/spec/features/versions/create_spec.rb b/spec/features/versions/create_spec.rb
index 5819bc749e8..a64488756b6 100644
--- a/spec/features/versions/create_spec.rb
+++ b/spec/features/versions/create_spec.rb
@@ -48,7 +48,7 @@ describe 'version create', type: :feature, js: false do
fill_in 'Name', with: new_version_name
click_on 'Create'
- expect(page).to have_current_path(versions_settings_project_path(project))
+ expect(page).to have_current_path(project_settings_versions_path(project))
expect(page).to have_content new_version_name
end
diff --git a/spec/features/versions/project_settings_index_spec.rb b/spec/features/versions/project_settings_index_spec.rb
index 740bc62d602..0952aa6501d 100644
--- a/spec/features/versions/project_settings_index_spec.rb
+++ b/spec/features/versions/project_settings_index_spec.rb
@@ -48,7 +48,7 @@ feature 'project settings index', type: :feature do
@javascript
scenario 'see versions listed in semver order' do
- visit versions_settings_project_path(project)
+ visit project_settings_versions_path(project)
names_in_order = page.all('.version .name').map { |el| el.text.strip }
diff --git a/spec/features/wiki/adding_editing_history_spec.rb b/spec/features/wiki/adding_editing_history_spec.rb
index 09087bdc21e..b0ad5927e70 100644
--- a/spec/features/wiki/adding_editing_history_spec.rb
+++ b/spec/features/wiki/adding_editing_history_spec.rb
@@ -57,7 +57,7 @@ describe 'wiki pages', type: :feature, js: true, with_settings: { journal_aggreg
end
scenario 'adding, editing and history' do
- visit modules_settings_project_path(project)
+ visit project_settings_modules_path(project)
expect(page).to have_no_selector('.menu-sidebar .main-item-wrapper', text: 'Wiki')
diff --git a/spec/features/work_packages/details/inplace_editor/version_editor_spec.rb b/spec/features/work_packages/details/inplace_editor/version_editor_spec.rb
index 868623df849..8c2c2b97488 100644
--- a/spec/features/work_packages/details/inplace_editor/version_editor_spec.rb
+++ b/spec/features/work_packages/details/inplace_editor/version_editor_spec.rb
@@ -87,7 +87,7 @@ describe 'subject inplace editor', js: true, selenium: true do
field.set_new_value 'Super cool new release'
field.expect_state_text 'Super cool new release'
- visit versions_settings_project_path(project)
+ visit project_settings_versions_path(project)
expect(page).to have_content 'Super cool new release'
end
end
diff --git a/spec/lib/api/v3/work_packages/work_package_representer_spec.rb b/spec/lib/api/v3/work_packages/work_package_representer_spec.rb
index 5ac37c1a892..694c61f85d1 100644
--- a/spec/lib/api/v3/work_packages/work_package_representer_spec.rb
+++ b/spec/lib/api/v3/work_packages/work_package_representer_spec.rb
@@ -1043,7 +1043,7 @@ describe ::API::V3::WorkPackages::WorkPackageRepresenter do
it_behaves_like 'action link' do
let(:action) { 'customFields' }
let(:permission) { :edit_project }
- let(:href) { custom_fields_settings_project_path(work_package.project.identifier) }
+ let(:href) { project_settings_custom_fields_path(work_package.project.identifier) }
end
end
diff --git a/spec/support/pages/projects/settings.rb b/spec/support/pages/projects/settings.rb
index b0c27bc50f1..01b1be71177 100644
--- a/spec/support/pages/projects/settings.rb
+++ b/spec/support/pages/projects/settings.rb
@@ -93,7 +93,7 @@ module Pages
end
def path
- general_settings_project_path(project)
+ project_settings_general_path(project)
end
end
end