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
feat[Op#54456]: reinstate real functionality
Kabiru Mwenja90322fc0dae7
diff --git a/app/components/settings/project_custom_fields/project_custom_field_mapping/row_component.rb b/app/components/settings/project_custom_fields/project_custom_field_mapping/row_component.rbindex 9507231aaee..73ab44fce18 100644--- a/app/components/settings/project_custom_fields/project_custom_field_mapping/row_component.rb+++ b/app/components/settings/project_custom_fields/project_custom_field_mapping/row_component.rb@@ -52,10 +52,7 @@ module Settingsid: @table.params[:custom_field].id,project_custom_field_project_mapping: { project_id: model.first.id }),- data: {- turbo_confirm: t("project.archive.are_you_sure", name: project.name),- turbo_method: :delete- }+ data: { turbo_method: :delete }}endenddiff --git a/app/contracts/project_custom_field_project_mappings/delete_contract.rb b/app/contracts/project_custom_field_project_mappings/delete_contract.rbnew file mode 100644index 00000000000..19873433025--- /dev/null+++ b/app/contracts/project_custom_field_project_mappings/delete_contract.rb@@ -0,0 +1,32 @@+#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2024 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 ProjectCustomFieldProjectMappings+ class DeleteContract < BaseContract+ end+enddiff --git a/app/controllers/admin/settings/project_custom_fields_controller.rb b/app/controllers/admin/settings/project_custom_fields_controller.rbindex 6d776b66ea0..1dcdafd7913 100644--- a/app/controllers/admin/settings/project_custom_fields_controller.rb+++ b/app/controllers/admin/settings/project_custom_fields_controller.rb@@ -35,7 +35,7 @@ module Admin::Settingsmenu_item :project_custom_fields_settingsbefore_action :set_sections, only: %i[show index edit move drop]- before_action :find_custom_field, only: %i(show edit destroy move drop)+ before_action :find_custom_field, only: %i[show edit unlink destroy move drop]def show_local_breadcrumbfalse@@ -62,21 +62,23 @@ module Admin::Settingsname: "project-custom-field-mapping-#{@custom_field.id}") do |query|query.where(:available_project_attributes, "=", [@custom_field.id])- query.select :name+ query.select(:name)endenddef unlink- # call = ProjectCustomFieldProjectMappings::ToggleService- # .new(user: current_user)- # .call(permitted_params.project_custom_field_project_mapping)+ project = Project.find(permitted_params.project_custom_field_project_mapping[:project_id])+ custom_field_project_mapping = @custom_field.project_custom_field_project_mappings.find_by(project:)+ delete_service = ProjectCustomFieldProjectMappings::DeleteService+ .new(user: current_user, model: custom_field_project_mapping)+ .call- project = Project.find(permitted_params.project_custom_field_project_mapping["project_id"])remove_via_turbo_stream(component: Settings::ProjectCustomFields::ProjectCustomFieldMapping::RowComponent- .new(row: [project, 0], table: OpenStruct.new(columns: [], favored_project_ids: [])))+ .new(row: [project, 0], table: nil)+ )- respond_to_with_turbo_streams(status: true ? :ok : :unprocessable_entity)+ respond_to_with_turbo_streams(status: delete_service.success? ? :ok : :unprocessable_entity)enddef movediff --git a/app/services/project_custom_field_project_mappings/delete_service.rb b/app/services/project_custom_field_project_mappings/delete_service.rbnew file mode 100644index 00000000000..3e0b4501a18--- /dev/null+++ b/app/services/project_custom_field_project_mappings/delete_service.rb@@ -0,0 +1,32 @@+#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2024 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 ProjectCustomFieldProjectMappings+ class DeleteService < ::BaseServices::Delete+ end+enddiff --git a/app/views/admin/settings/project_custom_fields/edit.html.erb b/app/views/admin/settings/project_custom_fields/edit.html.erbindex 6d8ee6828ae..f4e2a5687ca 100644--- a/app/views/admin/settings/project_custom_fields/edit.html.erb+++ b/app/views/admin/settings/project_custom_fields/edit.html.erb@@ -42,7 +42,7 @@ See COPYRIGHT and LICENSE files for more details.render partial: 'details_form', locals: { custom_field: @custom_field }end- tab.with_text { "Details" }+ tab.with_text { I18n.t(:label_details) }endcomponent.with_tab(selected: false, id: "project-custom-fields-mapping-tab") do |tab|@@ -51,7 +51,7 @@ See COPYRIGHT and LICENSE files for more details.locals: { custom_field: @custom_field, query: @project_custom_field_mapping_query }end- tab.with_text { "Projects" }+ tab.with_text { I18n.t(:label_project_plural) }endend%>