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

move general to nested settings

ulfertsa4f7dd4a11a2
diff --git a/app/controllers/project_settings/general_controller.rb b/app/controllers/projects/settings/general_controller.rb
similarity index 94%
rename from app/controllers/project_settings/general_controller.rb
rename to app/controllers/projects/settings/general_controller.rb
index 5c27b2ddb00..6d8f61acda6 100644
--- a/app/controllers/project_settings/general_controller.rb
+++ b/app/controllers/projects/settings/general_controller.rb
@@ -28,6 +28,6 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class ProjectSettings::GeneralController < ProjectSettingsController
+class Projects::Settings::GeneralController < ProjectSettingsController
menu_item :settings_general
end
diff --git a/app/controllers/projects/templated_controller.rb b/app/controllers/projects/templated_controller.rb
index 3c2a5ae64b5..8c286557a2d 100644
--- a/app/controllers/projects/templated_controller.rb
+++ b/app/controllers/projects/templated_controller.rb
@@ -50,10 +50,10 @@ class Projects::TemplatedController < ApplicationController
if service_call.success?
flash[:notice] = t(:notice_successful_update)
- redirect_to settings_general_project_path(@project)
+ redirect_to general_settings_project_path(@project)
else
@errors = service_call.errors
- render template: 'project_settings/general'
+ render template: 'projects/settings/general'
end
end
end
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index f7509b2f8a4..93a230d386f 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 settings_general_project_path(@project)
+ redirect_to general_settings_project_path(@project)
else
render action: 'identifier'
end
diff --git a/app/helpers/project_settings_helper.rb b/app/helpers/project_settings_helper.rb
index f0ffb137915..8a499ccb600 100644
--- a/app/helpers/project_settings_helper.rb
+++ b/app/helpers/project_settings_helper.rb
@@ -34,13 +34,12 @@ module ProjectSettingsHelper
[
{
name: 'general',
- action: { controller: '/project_settings/general', action: 'show' },
+ action: { controller: '/projects/settings/general', action: 'show' },
label: :label_information_plural
},
{
name: 'modules',
action: { controller: '/projects/settings/modules', action: 'show' },
- if: ->(project) { User.current.allowed_to?(:select_project_modules, project) },
label: :label_module_plural
},
{
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index b512b61cc26..b6590244b91 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -85,9 +85,9 @@ module ProjectsHelper
end
def project_more_menu_settings_item(project)
- if User.current.allowed_to?({ controller: '/project_settings/general', action: 'show' }, project)
+ if User.current.allowed_to?({ controller: '/projects/settings/general', action: 'show' }, project)
[t(:label_project_settings),
- { controller: '/project_settings/general', action: 'show', id: project },
+ general_settings_project_path(project),
{ class: 'icon-context icon-settings',
title: t(:label_project_settings) }]
end
diff --git a/app/views/projects/identifier.html.erb b/app/views/projects/identifier.html.erb
index 5c41e1753cc..a2e5b72b5ab 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 settings_general_project_path(@project), class: 'button' do %>
+ <%= link_to general_settings_project_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/project_settings/general/show.html.erb b/app/views/projects/settings/general/show.html.erb
similarity index 100%
rename from app/views/project_settings/general/show.html.erb
rename to app/views/projects/settings/general/show.html.erb
diff --git a/config/initializers/menus.rb b/config/initializers/menus.rb
index 71985b5cd3c..94384bcf673 100644
--- a/config/initializers/menus.rb
+++ b/config/initializers/menus.rb
@@ -474,7 +474,7 @@ Redmine::MenuManager.map :project_menu do |menu|
icon: 'icon2 icon-group'
menu.push :settings,
- { controller: '/project_settings/general', action: :show },
+ { controller: '/projects/settings/general', action: :show },
caption: :label_project_settings,
last: true,
icon: 'icon2 icon-settings2',
diff --git a/config/initializers/permissions.rb b/config/initializers/permissions.rb
index c07e94f9905..466abcc519c 100644
--- a/config/initializers/permissions.rb
+++ b/config/initializers/permissions.rb
@@ -76,7 +76,7 @@ OpenProject::AccessControl.map do |map|
map.permission :edit_project,
{
projects: %i[custom_fields],
- 'project_settings/general': %i[show],
+ 'projects/settings/general': %i[show],
'projects/templated': %i[create destroy]
},
require: :member,
diff --git a/config/routes.rb b/config/routes.rb
index 4ab0a839275..1610f57316c 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -184,7 +184,7 @@ OpenProject::Application.routes.draw do
namespace 'settings' do
ProjectSettingsHelper
.project_settings_tabs
- .select { |s| s[:name] == 'modules' }
+ .select { |s| %w[modules general].include?(s[:name]) }
.each do |tab|
get tab[:name],
controller: tab[:name],
@@ -198,7 +198,7 @@ OpenProject::Application.routes.draw do
ProjectSettingsHelper
.project_settings_tabs
- .reject { |s| s[:name] == 'modules' }
+ .reject { |s| %w[modules general].include?(s[:name]) }
.each do |tab|
get "settings/#{tab[:name]}",
controller: "project_settings/#{tab[:name]}",
diff --git a/spec/features/projects/edit_settings_spec.rb b/spec/features/projects/edit_settings_spec.rb
index c92ad0d5a37..fc52c159061 100644
--- a/spec/features/projects/edit_settings_spec.rb
+++ b/spec/features/projects/edit_settings_spec.rb
@@ -44,13 +44,13 @@ describe 'Projects', 'editing settings', type: :feature, js: true do
end
it 'hides the field whose functionality is presented otherwise' do
- visit settings_general_project_path(project.id)
+ visit general_settings_project_path(project.id)
expect(page).to have_no_text :all, 'Active'
expect(page).to have_no_text :all, 'Identifier'
end
- describe 'identifier edit' do
+ describe 'identifier edit', js: false do
it 'updates the project identifier' do
visit projects_path
click_on project.name
@@ -59,14 +59,15 @@ describe 'Projects', 'editing settings', type: :feature, js: true do
SeleniumHubWaiter.wait
click_on 'Change identifier'
- expect(page).to have_content "CHANGE THE PROJECT'S IDENTIFIER"
- expect(current_path).to eq '/projects/foo-project/identifier'
+ expect(page).to have_content "Change the project's identifier"
+ expect(page).to have_current_path '/projects/foo-project/identifier'
fill_in 'project[identifier]', with: 'foo-bar'
click_on 'Update'
expect(page).to have_content 'Successful update.'
- expect(current_path).to match '/projects/foo-bar/settings/generic'
+ expect(page)
+ .to have_current_path '/projects/foo-bar/settings/general'
expect(Project.first.identifier).to eq 'foo-bar'
end
@@ -77,7 +78,7 @@ describe 'Projects', 'editing settings', type: :feature, js: true do
click_on 'Update'
expect(page).to have_content 'Identifier is invalid.'
- expect(current_path).to eq '/projects/foo-project/identifier'
+ expect(page).to have_current_path '/projects/foo-project/identifier'
end
end
@@ -98,7 +99,7 @@ describe 'Projects', 'editing settings', type: :feature, js: true do
project.custom_field_values.last.value = 'FOO'
project.save!
- visit settings_general_project_path(project.id)
+ visit general_settings_project_path(project.id)
expect(page).to have_text 'Optional Foo'
expect(page).to have_text 'Required Foo'
@@ -117,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 settings_general_project_path(project.id)
+ visit general_settings_project_path(project.id)
expect(page).to have_content 'Foo'
@@ -140,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 settings_general_project_path(project.id)
+ visit general_settings_project_path(project.id)
form_field.select_option 'A', 'B'
@@ -161,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 settings_general_project_path(project.id)
+ visit general_settings_project_path(project.id)
form_field.set_value '2021-05-26'
form_field.send_keys :escape
@@ -188,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 settings_general_project_path(project.id)
+ visit general_settings_project_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 272e8b2d02f..374f221ba3b 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 settings_general_project_path(id: 'new-project')
+ visit general_settings_project_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 9fdf243258c..880021ad22a 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 settings_general_project_path(created_project)
+ visit general_settings_project_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 settings_general_project_path(project.id)
+ visit general_settings_project_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 settings_general_project_path(project)
+ visit general_settings_project_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 settings_general_project_path(project)
+ visit general_settings_project_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 settings_general_project_path(project.id)
+ visit general_settings_project_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 7ca836b7a8e..cb875e24cd6 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 settings_general_project_path(parent_project)
+ visit general_settings_project_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 3ba23f9fd27..e8b3a21fe99 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 settings_general_project_path(project)
+ visit general_settings_project_path(project)
# Make a template
find('.button', text: 'Set as template').click
diff --git a/spec/lib/open_project/access_control_spec.rb b/spec/lib/open_project/access_control_spec.rb
index 7b5226c1bd7..b14ebb821b5 100644
--- a/spec/lib/open_project/access_control_spec.rb
+++ b/spec/lib/open_project/access_control_spec.rb
@@ -156,7 +156,7 @@ describe OpenProject::AccessControl do
it 'includes actions' do
expect(subject.controller_actions)
- .to include('project_settings/general/show')
+ .to include('projects/settings/general/show')
end
end
end
diff --git a/spec/support/pages/projects/settings.rb b/spec/support/pages/projects/settings.rb
index 9558301d961..b0c27bc50f1 100644
--- a/spec/support/pages/projects/settings.rb
+++ b/spec/support/pages/projects/settings.rb
@@ -93,7 +93,7 @@ module Pages
end
def path
- settings_general_project_path(project)
+ general_settings_project_path(project)
end
end
end
diff --git a/spec/views/project_settings/general/show.html.erb_spec.rb b/spec/views/projects/settings/general/show.html.erb_spec.rb
similarity index 98%
rename from spec/views/project_settings/general/show.html.erb_spec.rb
rename to spec/views/projects/settings/general/show.html.erb_spec.rb
index cf40be8556e..a07213a962a 100644
--- a/spec/views/project_settings/general/show.html.erb_spec.rb
+++ b/spec/views/projects/settings/general/show.html.erb_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-describe 'project_settings/general/show', type: :view do
+describe 'projects/settings/general/show', type: :view do
let(:project) { FactoryBot.build_stubbed(:project) }
describe 'project copy permission' do