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
Add destroy methods
Mir Bhatiae3ce73ca217e
diff --git a/modules/meeting/app/components/meeting_agenda_items/outcomes/base_component.html.erb b/modules/meeting/app/components/meeting_agenda_items/outcomes/base_component.html.erbindex 6652f2d8424..a60dfcb8056 100644--- a/modules/meeting/app/components/meeting_agenda_items/outcomes/base_component.html.erb+++ b/modules/meeting/app/components/meeting_agenda_items/outcomes/base_component.html.erb@@ -10,7 +10,7 @@unless @hide_notesgrid.with_area(:notes) doif @state == :edit- render(MeetingAgendaItems::Outcomes::NewComponent.new(meeting: @meeting, meeting_agenda_item: @meeting_agenda_item, meeting_outcome: @meeting_outcome, hidden: false))+ render(MeetingAgendaItems::Outcomes::InputComponent.new(meeting: @meeting, meeting_agenda_item: @meeting_agenda_item, meeting_outcome: @meeting_outcome, hidden: false))elsif @state == :showrender(MeetingAgendaItems::Outcomes::ShowNotesComponent.new(meeting_outcome: @meeting_outcome))enddiff --git a/modules/meeting/app/components/meeting_agenda_items/outcomes/new_component.html.erb b/modules/meeting/app/components/meeting_agenda_items/outcomes/input_component.html.erbsimilarity index 100%rename from modules/meeting/app/components/meeting_agenda_items/outcomes/new_component.html.erbrename to modules/meeting/app/components/meeting_agenda_items/outcomes/input_component.html.erbdiff --git a/modules/meeting/app/components/meeting_agenda_items/outcomes/new_component.rb b/modules/meeting/app/components/meeting_agenda_items/outcomes/input_component.rbsimilarity index 98%rename from modules/meeting/app/components/meeting_agenda_items/outcomes/new_component.rbrename to modules/meeting/app/components/meeting_agenda_items/outcomes/input_component.rbindex 392b3e81565..7e07794999c 100644--- a/modules/meeting/app/components/meeting_agenda_items/outcomes/new_component.rb+++ b/modules/meeting/app/components/meeting_agenda_items/outcomes/input_component.rb@@ -27,7 +27,7 @@#++module MeetingAgendaItems::Outcomes- class NewComponent < ApplicationComponent+ class InputComponent < ApplicationComponentinclude ApplicationHelperinclude OpTurbo::Streamableinclude OpPrimer::ComponentHelpersdiff --git a/modules/meeting/app/components/meeting_agenda_items/outcomes/show_notes_component.rb b/modules/meeting/app/components/meeting_agenda_items/outcomes/show_notes_component.rbindex a8c266de56a..5dba3613efc 100644--- a/modules/meeting/app/components/meeting_agenda_items/outcomes/show_notes_component.rb+++ b/modules/meeting/app/components/meeting_agenda_items/outcomes/show_notes_component.rb@@ -69,7 +69,7 @@ module MeetingAgendaItemsdef delete_action_item(menu)menu.with_item(label: t("label_agenda_outcome_delete"),scheme: :danger,- href: "",+ href: meeting_outcome_path(@meeting, @meeting_outcome),form_arguments: {method: :delete, data: { confirm: t("text_are_you_sure"), "turbo-stream": true }}) do |item|diff --git a/modules/meeting/app/contracts/meeting_outcomes/delete_contract.rb b/modules/meeting/app/contracts/meeting_outcomes/delete_contract.rbnew file mode 100644index 00000000000..99f4a1202fb--- /dev/null+++ b/modules/meeting/app/contracts/meeting_outcomes/delete_contract.rb@@ -0,0 +1,37 @@+#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 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 MeetingOutcomes+ class DeleteContract < ::DeleteContract+ include ModifiableItem++ delete_permission -> {+ user.allowed_in_project?(:create_meeting_minutes, model.meeting_agenda_item.project)+ }+ end+enddiff --git a/modules/meeting/app/controllers/meeting_outcomes_controller.rb b/modules/meeting/app/controllers/meeting_outcomes_controller.rbindex ee081910b5f..00770beb64a 100644--- a/modules/meeting/app/controllers/meeting_outcomes_controller.rb+++ b/modules/meeting/app/controllers/meeting_outcomes_controller.rb@@ -34,7 +34,7 @@ class MeetingOutcomesController < ApplicationControllerinclude Meetings::AgendaComponentStreamsbefore_action :set_meeting- before_action :set_meeting_agenda_item, except: %i[edit cancel_edit update]+ before_action :set_meeting_agenda_item, except: %i[edit cancel_edit update destroy]before_action :set_meeting_outcome, except: %i[new cancel_new create]before_action :authorize_global, only: %i[new create]before_action :authorize, except: %i[new create]@@ -120,6 +120,20 @@ class MeetingOutcomesController < ApplicationControllerrespond_with_turbo_streamsend+ def destroy+ @meeting_agenda_item = @meeting_outcome.meeting_agenda_item+ call = ::MeetingOutcomes::DeleteService+ .new(user: current_user, model: @meeting_outcome)+ .call++ if call.success?+ render_base_outcome_component_via_turbo_stream(meeting: @meeting, meeting_agenda_item: @meeting_agenda_item, hide_notes: true)+ # else+ end++ respond_with_turbo_streams+ end+privatedef set_meetingdiff --git a/modules/meeting/app/services/meeting_outcomes/delete_service.rb b/modules/meeting/app/services/meeting_outcomes/delete_service.rbnew file mode 100644index 00000000000..a1e840d2674--- /dev/null+++ b/modules/meeting/app/services/meeting_outcomes/delete_service.rb@@ -0,0 +1,32 @@+#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 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 MeetingOutcomes+ class DeleteService < ::BaseServices::Delete+ end+end