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
move time entry activities to nested settings
ulferts81e45a2a9dc4
diff --git a/app/controllers/project_settings/activities_controller.rb b/app/controllers/project_settings/activities_controller.rbdeleted file mode 100644index 7efce9b8cf4..00000000000--- a/app/controllers/project_settings/activities_controller.rb+++ /dev/null@@ -1,37 +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.-#++--class ProjectSettings::ActivitiesController < ProjectSettingsController- menu_item :settings_activities-- def show- render template: 'project_settings/activities'- end-enddiff --git a/app/helpers/project_settings_helper.rb b/app/helpers/project_settings_helper.rbindex 88a9ccbe1cc..178b3ec1880 100644--- a/app/helpers/project_settings_helper.rb+++ b/app/helpers/project_settings_helper.rb@@ -69,8 +69,8 @@ module ProjectSettingsHelperlabel: :label_repository},{- name: 'activities',- action: { controller: '/project_settings/activities', action: 'show' },+ name: 'time_entry_activities',+ action: { controller: '/projects/settings/time_entry_activities', action: 'show' },label: :enumeration_activities},{diff --git a/app/views/projects/form/_project_attributes.html.erb b/app/views/projects/form/_project_attributes.html.erbdeleted file mode 100644index 085655b19df..00000000000--- a/app/views/projects/form/_project_attributes.html.erb+++ /dev/null@@ -1,70 +0,0 @@-<%#-- 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.--++#%>-<% all_fields = (render_advanced) ? false : true %>--<%= render partial: "projects/form/attributes/name",- locals: { form: form } %>--<% if project.new_record? && !is_copy %>- <%= render partial: "projects/form/select_template",- locals: { project: project, form: form } %>-<% end %>--<%= render partial: "customizable/form",- locals: { form: form, help_text: { 'attribute-scope': :Project }, all_fields: all_fields, only_required: render_advanced } %>-<% if render_advanced %>-<fieldset id="advanced-project-settings" class="form--fieldset -collapsible collapsed">- <legend class="form--fieldset-legend" title="<%=t(:label_show_hide)%>" >- <a href="#"><%= t(:label_advanced_settings) %></a>- </legend>-- <div style="display:none;" class="advanced-settings-inner">-<% end %>- <%= render partial: "projects/form/attributes/parent_id",- locals: { form: form } %>- <%= render partial: "projects/form/attributes/description",- locals: { form: form } %>- <%= render partial: "projects/form/attributes/public",- locals: { form: form } %>- <%= render partial: "projects/form/attributes/status",- locals: { form: form } %>- <% unless all_fields %>- <%= render partial: "customizable/form",- locals: { form: form, help_text: { 'attribute-scope': :Project }, all_fields: false, only_required: false } %>- <% end %>-<% if render_advanced %>- </div>-</fieldset>-<% end %>--<% unless form.object.errors[:identifier].blank? %>- <%= nonced_javascript_tag do %>- jQuery('#advanced-project-settings > .advanced-settings-inner').show();- <% end %>-<% end %>diff --git a/app/views/projects/form/_select_template.html.erb b/app/views/projects/form/_select_template.html.erbdeleted file mode 100644index ada2d0d9d8a..00000000000--- a/app/views/projects/form/_select_template.html.erb+++ /dev/null@@ -1,39 +0,0 @@-<%#-- 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.--++#%>--<div class="form--field">- <%= styled_label_tag 'from_template', t('project.template.use_template') %>- <div class="form--field-container">- <%= styled_select_tag :from_template,- options_for_select(project_options_for_templated, @template_project&.id),- id: 'project-select-template',- prompt: "(#{t(:label_none)})",- container_class: '-wide' %>- </div>-</div>diff --git a/config/routes.rb b/config/routes.rbindex fb7392a7b26..26e634cc847 100644--- a/config/routes.rb+++ b/config/routes.rb@@ -184,7 +184,7 @@ OpenProject::Application.routes.draw donamespace 'settings' doProjectSettingsHelper.project_settings_tabs- .select { |s| %w[modules general types custom_fields versions categories repository].include?(s[:name]) }+ .select { |s| %w[modules general types custom_fields versions categories repository time_entry_activities].include?(s[:name]) }.each do |tab|get tab[:name],controller: tab[:name],@@ -198,7 +198,7 @@ OpenProject::Application.routes.draw doProjectSettingsHelper.project_settings_tabs- .reject { |s| %w[modules general types custom_fields versions categories repository].include?(s[:name]) }+ .reject { |s| %w[modules general types custom_fields versions categories repository time_entry_activities].include?(s[:name]) }.each do |tab|get "settings/#{tab[:name]}",controller: "project_settings/#{tab[:name]}",@@ -228,8 +228,6 @@ OpenProject::Application.routes.draw doget :level_listend- resource :time_entry_activities, controller: 'projects/time_entry_activities', only: %i[update]-resources :versions, only: %i[new create] docollection doput :close_completeddiff --git a/modules/costs/app/controllers/projects/time_entry_activities_controller.rb b/modules/costs/app/controllers/projects/settings/time_entry_activities_controller.rbsimilarity index 89%rename from modules/costs/app/controllers/projects/time_entry_activities_controller.rbrename to modules/costs/app/controllers/projects/settings/time_entry_activities_controller.rbindex 0829fc80c25..e9c536e15cc 100644--- a/modules/costs/app/controllers/projects/time_entry_activities_controller.rb+++ b/modules/costs/app/controllers/projects/settings/time_entry_activities_controller.rb@@ -28,15 +28,14 @@# See COPYRIGHT and LICENSE files for more details.#++-class Projects::TimeEntryActivitiesController < ApplicationController- before_action :find_project_by_project_id- before_action :authorize+class Projects::Settings::TimeEntryActivitiesController < ProjectSettingsController+ menu_item :settings_time_entry_activitiesdef updateTimeEntryActivitiesProject.upsert_all(update_params, unique_by: %i[project_id activity_id])flash[:notice] = t(:notice_successful_update)- redirect_to settings_activities_project_path(@project)+ redirect_to time_entry_activities_settings_project_path(@project)endprivatediff --git a/app/views/projects/form/_activities.html.erb b/modules/costs/app/views/projects/settings/time_entry_activities/_activities.html.erbsimilarity index 90%rename from app/views/projects/form/_activities.html.erbrename to modules/costs/app/views/projects/settings/time_entry_activities/_activities.html.erbindex c2a4dac662f..e78b5b392f0 100644--- a/app/views/projects/form/_activities.html.erb+++ b/modules/costs/app/views/projects/settings/time_entry_activities/_activities.html.erb@@ -44,8 +44,6 @@ See COPYRIGHT and LICENSE files for more details.</div><% end %>-<% if withControlls == true %>- <div class="generic-table--action-buttons">- <%= styled_button_tag t(:button_save), class: '-highlight -with-icon icon-checkmark' %>- </div>-<% end %>+<div class="generic-table--action-buttons">+ <%= styled_button_tag t(:button_save), class: '-highlight -with-icon icon-checkmark' %>+</div>diff --git a/app/views/project_settings/activities.html.erb b/modules/costs/app/views/projects/settings/time_entry_activities/show.html.erbsimilarity index 86%rename from app/views/project_settings/activities.html.erbrename to modules/costs/app/views/projects/settings/time_entry_activities/show.html.erbindex a040a4d9399..49b169e4804 100644--- a/app/views/project_settings/activities.html.erb+++ b/modules/costs/app/views/projects/settings/time_entry_activities/show.html.erb@@ -32,10 +32,10 @@ See COPYRIGHT and LICENSE files for more details.<% if TimeEntryActivity.any? %><%= labelled_tabular_form_for @project,- url: project_time_entry_activities_path(@project),- method: :put do %>+ url: time_entry_activities_settings_project_path(@project) do %>- <%= render partial: 'projects/form/activities', locals: { project: @project, withControlls: true } %>+ <%= render partial: '/projects/settings/time_entry_activities/activities',+ locals: { project: @project } %><% end %><br/>diff --git a/modules/costs/lib/costs/engine.rb b/modules/costs/lib/costs/engine.rbindex 8bec7e61bf4..e4d62577e09 100644--- a/modules/costs/lib/costs/engine.rb+++ b/modules/costs/lib/costs/engine.rb@@ -60,7 +60,7 @@ module Costsrequire: :loggedinpermission :manage_project_activities,- { 'projects/time_entry_activities': %i[update] },+ { 'projects/settings/time_entry_activities': %i[show update] },require: :memberpermission :view_own_hourly_rate, {}permission :view_hourly_rates, {}diff --git a/modules/costs/spec/features/time_entry/activity_spec.rb b/modules/costs/spec/features/time_entry/activity_spec.rbindex 94c33afd797..1734376a5cb 100644--- a/modules/costs/spec/features/time_entry/activity_spec.rb+++ b/modules/costs/spec/features/time_entry/activity_spec.rb@@ -30,6 +30,7 @@ require 'spec_helper'describe 'Time entry activity', type: :feature doshared_let(:admin) { FactoryBot.create :admin }+ let(:project) { FactoryBot.create(:project) }before dologin_as(admin)@@ -48,5 +49,22 @@ describe 'Time entry activity', type: :feature doexpect(page).to have_content('A new activity')++ visit general_settings_project_path(project)++ click_on "Time tracking activities"++ expect(page)+ .to have_field('A new activity', checked: true)++ uncheck 'A new activity'++ click_on 'Save'++ expect(page)+ .to have_content "Successful update."++ expect(page)+ .to have_field('A new activity', checked: false)endenddiff --git a/spec/routing/project_settings_routing_spec.rb b/spec/routing/project_settings_routing_spec.rbindex a3c8a412e8c..09925901bf9 100644--- a/spec/routing/project_settings_routing_spec.rb+++ b/spec/routing/project_settings_routing_spec.rb@@ -87,9 +87,9 @@ describe ProjectSettingsController, type: :routing doendit do- expect(get('/projects/123/settings/activities'))+ expect(get('/projects/123/settings/time_entry_activities')).to route_to(- controller: 'project_settings/activities', action: 'show', id: '123'+ controller: 'projects/settings/time_entry_activities', action: 'show', id: '123')enddiff --git a/spec/routing/projects/time_entry_activities_spec.rb b/spec/routing/projects/time_entry_activities_spec.rbdeleted file mode 100644index 263e864c09c..00000000000--- a/spec/routing/projects/time_entry_activities_spec.rb+++ /dev/null@@ -1,38 +0,0 @@-#-- 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.-#++--require 'spec_helper'--describe 'project/time_entry_activities routes', type: :routing do- describe 'update' do- it 'links PUT /projects/:project_id/time_entry_activities' do- expect(put('/projects/64/time_entry_activities'))- .to route_to('projects/time_entry_activities#update', project_id: '64')- end- end-end