mirror of
https://github.com/opf/openproject.git
synced 2026-06-14 03:30:14 +00:00
rename generic to general settings
This commit is contained in:
+2
-7
@@ -28,11 +28,6 @@
|
||||
# See COPYRIGHT and LICENSE files for more details.
|
||||
#++
|
||||
|
||||
class ProjectSettings::GenericController < ProjectSettingsController
|
||||
menu_item :settings_generic
|
||||
|
||||
def show
|
||||
@altered_project = @project
|
||||
render template: 'project_settings/generic'
|
||||
end
|
||||
class ProjectSettings::GeneralController < ProjectSettingsController
|
||||
menu_item :settings_general
|
||||
end
|
||||
@@ -44,7 +44,10 @@ class ProjectsController < ApplicationController
|
||||
include RepositoriesHelper
|
||||
include ProjectsHelper
|
||||
|
||||
# Lists visible projects
|
||||
current_menu_item :index do
|
||||
:list_projects
|
||||
end
|
||||
|
||||
def index
|
||||
query = load_query
|
||||
|
||||
@@ -58,10 +61,6 @@ class ProjectsController < ApplicationController
|
||||
render layout: 'no_menu'
|
||||
end
|
||||
|
||||
current_menu_item :index do
|
||||
:list_projects
|
||||
end
|
||||
|
||||
def new
|
||||
render layout: 'no_menu'
|
||||
end
|
||||
@@ -76,7 +75,7 @@ class ProjectsController < ApplicationController
|
||||
|
||||
if service_call.success?
|
||||
flash[:notice] = I18n.t(:notice_successful_update)
|
||||
redirect_to settings_generic_project_path(@project)
|
||||
redirect_to settings_general_project_path(@project)
|
||||
else
|
||||
render action: 'identifier'
|
||||
end
|
||||
@@ -149,12 +148,6 @@ class ProjectsController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
##
|
||||
# Redirect as action as routes can only redirect by full path
|
||||
def settings
|
||||
redirect_to settings_generic_project_path(@project)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_optional_project
|
||||
|
||||
@@ -33,8 +33,8 @@ module ProjectSettingsHelper
|
||||
def project_settings_tabs
|
||||
[
|
||||
{
|
||||
name: 'generic',
|
||||
action: { controller: '/project_settings/generic', action: 'show' },
|
||||
name: 'general',
|
||||
action: { controller: '/project_settings/general', action: 'show' },
|
||||
label: :label_information_plural
|
||||
},
|
||||
{
|
||||
|
||||
@@ -85,9 +85,9 @@ module ProjectsHelper
|
||||
end
|
||||
|
||||
def project_more_menu_settings_item(project)
|
||||
if User.current.allowed_to?({ controller: '/project_settings/generic', action: 'show' }, project)
|
||||
if User.current.allowed_to?({ controller: '/project_settings/general', action: 'show' }, project)
|
||||
[t(:label_project_settings),
|
||||
{ controller: '/project_settings/generic', action: 'show', id: project },
|
||||
{ controller: '/project_settings/general', action: 'show', id: project },
|
||||
{ class: 'icon-context icon-settings',
|
||||
title: t(:label_project_settings) }]
|
||||
end
|
||||
|
||||
@@ -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_generic_project_path(@project), class: 'button' do %>
|
||||
<%= link_to settings_general_project_path(@project), class: 'button' do %>
|
||||
<%= op_icon('button--icon icon-cancel') %>
|
||||
<span class="button--text"><%= t(:button_cancel) %></span>
|
||||
<% end %>
|
||||
|
||||
@@ -474,7 +474,7 @@ Redmine::MenuManager.map :project_menu do |menu|
|
||||
icon: 'icon2 icon-group'
|
||||
|
||||
menu.push :settings,
|
||||
{ controller: '/project_settings/generic', action: :show },
|
||||
{ controller: '/project_settings/general', action: :show },
|
||||
caption: :label_project_settings,
|
||||
last: true,
|
||||
icon: 'icon2 icon-settings2',
|
||||
|
||||
@@ -75,8 +75,8 @@ OpenProject::AccessControl.map do |map|
|
||||
|
||||
map.permission :edit_project,
|
||||
{
|
||||
projects: %i[edit update custom_fields],
|
||||
'project_settings/generic': [:show]
|
||||
projects: %i[custom_fields],
|
||||
'project_settings/general': %i[show]
|
||||
},
|
||||
require: :member,
|
||||
contract_actions: { projects: %i[update] }
|
||||
|
||||
+9
-3
@@ -178,10 +178,16 @@ OpenProject::Application.routes.draw do
|
||||
resources :projects, except: %i[show edit create] do
|
||||
member do
|
||||
ProjectSettingsHelper.project_settings_tabs.each do |tab|
|
||||
get "settings/#{tab[:name]}", controller: "project_settings/#{tab[:name]}", action: 'show', as: "settings_#{tab[:name]}"
|
||||
patch "settings/#{tab[:name]}", controller: "project_settings/#{tab[:name]}", action: 'update', as: "update_settings_#{tab[:name]}"
|
||||
get "settings/#{tab[:name]}",
|
||||
controller: "project_settings/#{tab[:name]}",
|
||||
action: :show,
|
||||
as: "settings_#{tab[:name]}"
|
||||
patch "settings/#{tab[:name]}",
|
||||
controller: "project_settings/#{tab[:name]}",
|
||||
action: :update,
|
||||
as: "update_settings_#{tab[:name]}"
|
||||
end
|
||||
get "settings"
|
||||
get "settings", to: redirect('projects/%{id}/settings/general/') # rubocop:disable Style/FormatStringToken
|
||||
|
||||
get 'identifier', action: 'identifier'
|
||||
patch 'identifier', action: 'update_identifier'
|
||||
|
||||
@@ -133,7 +133,7 @@ export const OPENPROJECT_ROUTES:Ng2StateDeclaration[] = [
|
||||
{
|
||||
name: 'project_settings.**',
|
||||
parent: 'optional_project',
|
||||
url: '/settings/generic',
|
||||
url: '/settings/general',
|
||||
loadChildren: () => import('../../features/projects/openproject-projects.module').then((m) => m.OpenprojectProjectsModule),
|
||||
},
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@ export const PROJECTS_ROUTES:Ng2StateDeclaration[] = [
|
||||
{
|
||||
name: 'project_settings',
|
||||
parent: 'optional_project',
|
||||
url: '/settings/generic/',
|
||||
url: '/settings/general/',
|
||||
component: ProjectsComponent,
|
||||
},
|
||||
{
|
||||
@@ -28,7 +28,7 @@ export function uiRouterProjectsConfiguration(uiRouter:UIRouter) {
|
||||
// cf., https://community.openproject.com/wp/29754
|
||||
uiRouter.urlService.rules
|
||||
.when(
|
||||
new RegExp('^/projects/(.*)/settings/generic$'),
|
||||
(match) => `/projects/${match[1]}/settings/generic/`,
|
||||
new RegExp('^/projects/(.*)/settings/general$'),
|
||||
(match:string[]) => `/projects/${match[1]}/settings/general/`,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -180,13 +180,18 @@ describe ProjectsController, type: :controller do
|
||||
|
||||
before do
|
||||
allow(Project).to receive(:find).and_return(project)
|
||||
expect_any_instance_of(::Projects::ScheduleDeletionService)
|
||||
.to receive(:call)
|
||||
.and_return service_result
|
||||
deletion_service = instance_double(::Projects::ScheduleDeletionService,
|
||||
call: service_result)
|
||||
|
||||
allow(::Projects::ScheduleDeletionService)
|
||||
.to receive(:new)
|
||||
.with(user: admin, model: project)
|
||||
.and_return(deletion_service)
|
||||
end
|
||||
|
||||
context 'when service call succeeds' do
|
||||
let(:success) { true }
|
||||
|
||||
it 'prints success' do
|
||||
request
|
||||
expect(response).to be_redirect
|
||||
@@ -196,6 +201,7 @@ describe ProjectsController, type: :controller do
|
||||
|
||||
context 'when service call fails' do
|
||||
let(:success) { false }
|
||||
|
||||
it 'prints fail' do
|
||||
request
|
||||
expect(response).to be_redirect
|
||||
|
||||
@@ -52,13 +52,13 @@ describe 'menu permissions', type: :feature, js: true do
|
||||
expect(page).to have_selector('#menu-sidebar .op-menu--item-title', text: 'Modules')
|
||||
end
|
||||
|
||||
it 'the parent node directs to the generic settings page' do
|
||||
it 'the parent node directs to the general settings page' do
|
||||
# The settings menu item exists
|
||||
expect(page).to have_selector('#menu-sidebar .main-item-wrapper', text: 'Project settings', visible: false)
|
||||
|
||||
# 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 "/projects/#{project.identifier}/settings/generic/"
|
||||
expect(page).to have_current_path "/projects/#{project.identifier}/settings/general/"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -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 settings_generic_project_path(project.id)
|
||||
visit settings_general_project_path(project.id)
|
||||
|
||||
expect(page).to have_no_text :all, 'Active'
|
||||
expect(page).to have_no_text :all, 'Identifier'
|
||||
@@ -98,7 +98,7 @@ describe 'Projects', 'editing settings', type: :feature, js: true do
|
||||
project.custom_field_values.last.value = 'FOO'
|
||||
project.save!
|
||||
|
||||
visit settings_generic_project_path(project.id)
|
||||
visit settings_general_project_path(project.id)
|
||||
|
||||
expect(page).to have_text 'Optional Foo'
|
||||
expect(page).to have_text 'Required Foo'
|
||||
@@ -117,7 +117,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_generic_project_path(project.id)
|
||||
visit settings_general_project_path(project.id)
|
||||
|
||||
expect(page).to have_content 'Foo'
|
||||
|
||||
@@ -140,7 +140,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_generic_project_path(project.id)
|
||||
visit settings_general_project_path(project.id)
|
||||
|
||||
form_field.select_option 'A', 'B'
|
||||
|
||||
@@ -161,7 +161,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_generic_project_path(project.id)
|
||||
visit settings_general_project_path(project.id)
|
||||
|
||||
form_field.set_value '2021-05-26'
|
||||
form_field.send_keys :escape
|
||||
@@ -188,7 +188,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_generic_project_path(project.id)
|
||||
visit settings_general_project_path(project.id)
|
||||
|
||||
fill_in 'Name', with: 'New project name'
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ describe 'Projects module administration',
|
||||
|
||||
before do
|
||||
login_as user_without_permission
|
||||
settings_page.visit_tab!('generic')
|
||||
settings_page.visit_tab!('general')
|
||||
end
|
||||
|
||||
it "I can't see the modules menu item" do
|
||||
|
||||
@@ -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_generic_project_path(id: 'new-project')
|
||||
visit settings_general_project_path(id: 'new-project')
|
||||
|
||||
status_field.expect_selected 'ON TRACK'
|
||||
status_description.expect_value 'Everything is fine at the start'
|
||||
|
||||
@@ -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_project_path(created_project)
|
||||
visit settings_general_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_generic_project_path(project.id)
|
||||
visit settings_general_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_generic_project_path(project)
|
||||
visit settings_general_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_generic_project_path(project)
|
||||
visit settings_general_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_generic_project_path(project.id)
|
||||
visit settings_general_project_path(project.id)
|
||||
field = page.find(identifier)
|
||||
expect(field).not_to be_checked
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ describe 'Subproject creation', type: :feature, js: true do
|
||||
end
|
||||
|
||||
before do
|
||||
visit settings_project_path(parent_project)
|
||||
visit settings_general_project_path(parent_project)
|
||||
end
|
||||
|
||||
it 'can create a subproject' do
|
||||
|
||||
@@ -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_generic_project_path(project)
|
||||
visit settings_general_project_path(project)
|
||||
|
||||
# Make a template
|
||||
find('.button', text: 'Set as template').click
|
||||
|
||||
@@ -156,7 +156,7 @@ describe OpenProject::AccessControl do
|
||||
|
||||
it 'includes actions' do
|
||||
expect(subject.controller_actions)
|
||||
.to include('project_settings/show')
|
||||
.to include('project_settings/general/show')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -31,8 +31,8 @@ require 'spec_helper'
|
||||
describe ProjectSettingsController, type: :routing do
|
||||
describe 'show' do
|
||||
it do
|
||||
expect(get('/projects/123/settings/generic')).to route_to(
|
||||
controller: 'project_settings/generic', action: 'show', id: '123'
|
||||
expect(get('/projects/123/settings/general')).to route_to(
|
||||
controller: 'project_settings/general', action: 'show', id: '123'
|
||||
)
|
||||
end
|
||||
|
||||
@@ -78,12 +78,4 @@ describe ProjectSettingsController, type: :routing do
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'miscellaneous' do
|
||||
it do
|
||||
expect(get('/projects/123/settings')).to route_to(
|
||||
controller: 'projects', action: 'settings', id: '123'
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -93,7 +93,7 @@ module Pages
|
||||
end
|
||||
|
||||
def path
|
||||
settings_generic_project_path(project)
|
||||
settings_general_project_path(project)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'project_settings/generic', type: :view do
|
||||
describe 'project_settings/general/show', type: :view do
|
||||
let(:project) { FactoryBot.build_stubbed(:project) }
|
||||
|
||||
describe 'project copy permission' do
|
||||
Reference in New Issue
Block a user