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
Update component layout & add edit/update methods
Mir Bhatia78a1c9f925eb
diff --git a/modules/meeting/app/components/_index.sass b/modules/meeting/app/components/_index.sassindex 554400e71d2..420fedfb6d7 100644--- a/modules/meeting/app/components/_index.sass+++ b/modules/meeting/app/components/_index.sass@@ -4,3 +4,5 @@@import "./meetings/side_panel/state_component.sass"@import "./meetings/side_panel/participants_component.sass"@import "./recurring_meetings/table_header_component.sass"+@import "./meeting_agenda_items/outcomes/show_notes_component.sass"+@import "./meeting_agenda_items/outcomes/form_component.sass"diff --git a/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.html.erb b/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.html.erbindex 712336161ff..d60ac47ca9c 100644--- a/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.html.erb+++ b/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.html.erb@@ -81,16 +81,18 @@grid.with_area(:notes, tag: :div) doif @meeting_agenda_item.notes.present?- render(Primer::Box.new(classes: "op-uc-container", mt: 1)) do+ render(Primer::Box.new(classes: notes_classes, mt: 1)) doformat_text(@meeting_agenda_item, :notes)endendend- grid.with_area(:outcomes, tag: :div) do- flex_layout do |flex|- flex.with_row do- render(MeetingAgendaItems::Outcomes::BaseComponent.new(meeting: @meeting, meeting_agenda_item: @meeting_agenda_item))+ if OpenProject::FeatureDecisions.meeting_outcomes_active?+ grid.with_area(:outcomes, tag: :div) do+ flex_layout do |flex|+ flex.with_row do+ render(MeetingAgendaItems::Outcomes::BaseComponent.new(meeting: @meeting, meeting_agenda_item: @meeting_agenda_item))+ endendendenddiff --git a/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.rb b/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.rbindex ed06a268bae..ea9cfb2b6ee 100644--- a/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.rb+++ b/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.rb@@ -145,5 +145,13 @@ module MeetingAgendaItems:subtleendend++ def notes_classes+ if OpenProject::FeatureDecisions.meeting_outcomes_active?+ "op-uc-container muted-color"+ else+ "op-uc-container"+ end+ endendenddiff --git a/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.sass b/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.sassindex 6a3604d9ff1..a0f07fdcbf7 100644--- a/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.sass+++ b/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.sass@@ -37,6 +37,9 @@ $meeting-agenda-item--presenter-width--mobile: 150px.custom-presenter-flexmargin-left: auto+ .muted-color+ color: var(--fgColor-muted)+@media screen and (max-width: $breakpoint-lg)grid-template-columns: 20px auto 1fr auto 50pxgrid-template-areas: "drag-handle content content content actions" ". title title title title" ". presenter duration . ." ". notes notes notes notes" ". outcomes outcomes outcomes outcomes"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 256ed9538e1..6652f2d8424 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@@ -1,14 +1,16 @@<%=component_wrapper do- grid_layout("op-meeting-outcome", tag: :div, id: "outcome-#{@meeting_agenda_item.id}") do |grid|- grid.with_area(:button) do- render(MeetingAgendaItems::Outcomes::NewButtonComponent.new(meeting: @meeting, meeting_agenda_item: @meeting_agenda_item))- end if @hide_notes+ grid_layout("op-meeting-outcome", tag: :div, id: "outcome-#{@meeting_agenda_item.id}", mt: 2) do |grid|+ if @hide_notes+ grid.with_area(:button) do+ render(MeetingAgendaItems::Outcomes::NewButtonComponent.new(meeting: @meeting, meeting_agenda_item: @meeting_agenda_item))+ end+ endunless @hide_notesgrid.with_area(:notes) doif @state == :edit- render(MeetingAgendaItems::Outcomes::NewComponent.new(meeting: @meeting, meeting_agenda_item: @meeting_agenda_item, hidden: false))+ render(MeetingAgendaItems::Outcomes::NewComponent.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/base_component.rb b/modules/meeting/app/components/meeting_agenda_items/outcomes/base_component.rbindex 2a195bb7647..4b4992135ff 100644--- a/modules/meeting/app/components/meeting_agenda_items/outcomes/base_component.rb+++ b/modules/meeting/app/components/meeting_agenda_items/outcomes/base_component.rb@@ -1,3 +1,5 @@+# frozen_string_literal: true+#-- copyright# OpenProject is an open source project management software.# Copyright (C) the OpenProject GmbH@@ -32,7 +34,7 @@ module MeetingAgendaItemsinclude OpTurbo::Streamableinclude OpPrimer::ComponentHelpers- def initialize(meeting:, meeting_agenda_item:, meeting_outcome: nil, state: :edit, hide_notes: true)+ def initialize(meeting:, meeting_agenda_item:, meeting_outcome: nil, state: :show, hide_notes: true)super@meeting = meeting@@ -42,7 +44,6 @@ module MeetingAgendaItems@hide_notes = hide_notesoverride- # binding.pryenddef wrapper_uniq_by@@ -52,8 +53,8 @@ module MeetingAgendaItemsprivatedef override- if @meeting_agenda_item&.outcomes&.information_kind&.first&.notes.present?- @meeting_outcome = @meeting_agenda_item&.outcomes&.information_kind&.first+ if @meeting_agenda_item.outcomes.exists? && @state != :edit+ @meeting_outcome = @meeting_agenda_item.outcomes.information_kind.last@state = :show@hide_notes = falseenddiff --git a/modules/meeting/app/components/meeting_agenda_items/outcomes/form_component.rb b/modules/meeting/app/components/meeting_agenda_items/outcomes/form_component.rbindex a0e5d139886..8277907ea90 100644--- a/modules/meeting/app/components/meeting_agenda_items/outcomes/form_component.rb+++ b/modules/meeting/app/components/meeting_agenda_items/outcomes/form_component.rb@@ -35,7 +35,6 @@ module MeetingAgendaItems::Outcomesdef initialize(meeting:, meeting_agenda_item:, meeting_outcome:, method:, submit_path:, cancel_path:,display_notes_input: nil)super- # binding.pry@meeting = meeting@meeting_agenda_item = meeting_agenda_item@meeting_outcome = meeting_outcomediff --git a/modules/meeting/app/components/meeting_agenda_items/outcomes/form_component.sass b/modules/meeting/app/components/meeting_agenda_items/outcomes/form_component.sassindex dcc9f21735e..b23bf2389a2 100644--- a/modules/meeting/app/components/meeting_agenda_items/outcomes/form_component.sass+++ b/modules/meeting/app/components/meeting_agenda_items/outcomes/form_component.sass@@ -2,13 +2,9 @@.op-meeting-outcome-formdisplay: grid- grid-template-columns: minmax(0, 100%) 100px minmax(200px, 1fr)- grid-template-areas: "title . ." "notes notes notes" ". actions actions"+ grid-template-columns: auto+ grid-template-areas: "notes" "actions"grid-gap: 8px- // Do not remove easily!- // The hidden labels of the form inputs are positioned absolutely,- // and thus break the whole layout if there is no container around them- position: relative&--actionsjustify-self: enddiff --git a/modules/meeting/app/components/meeting_agenda_items/outcomes/new_button_component.rb b/modules/meeting/app/components/meeting_agenda_items/outcomes/new_button_component.rbindex 80883097e2d..f7435f3663c 100644--- a/modules/meeting/app/components/meeting_agenda_items/outcomes/new_button_component.rb+++ b/modules/meeting/app/components/meeting_agenda_items/outcomes/new_button_component.rb@@ -36,7 +36,6 @@ module MeetingAgendaItems::Outcomesdef initialize(meeting:, meeting_agenda_item: nil, disabled: false)super- # binding.pry@meeting = meeting@meeting_agenda_item = meeting_agenda_item@disabled = @meeting.closed? || disableddiff --git a/modules/meeting/app/components/meeting_agenda_items/outcomes/new_component.html.erb b/modules/meeting/app/components/meeting_agenda_items/outcomes/new_component.html.erbindex 30fb17002a6..9a6a0f822d1 100644--- a/modules/meeting/app/components/meeting_agenda_items/outcomes/new_component.html.erb+++ b/modules/meeting/app/components/meeting_agenda_items/outcomes/new_component.html.erb@@ -6,9 +6,9 @@meeting: @meeting,meeting_agenda_item: @meeting_agenda_item,meeting_outcome: @meeting_outcome,- method: :post,- submit_path: meeting_outcomes_path(@meeting, meeting_agenda_item_id: @meeting_agenda_item&.id, format: :turbo_stream),- cancel_path: cancel_new_meeting_outcomes_path(@meeting, meeting_agenda_item_id: @meeting_agenda_item&.id)+ method:,+ submit_path:,+ cancel_path:))enddiff --git a/modules/meeting/app/components/meeting_agenda_items/outcomes/new_component.rb b/modules/meeting/app/components/meeting_agenda_items/outcomes/new_component.rbindex fab3a63f556..392b3e81565 100644--- a/modules/meeting/app/components/meeting_agenda_items/outcomes/new_component.rb+++ b/modules/meeting/app/components/meeting_agenda_items/outcomes/new_component.rb@@ -38,8 +38,6 @@ module MeetingAgendaItems::Outcomes@meeting_agenda_item = meeting_agenda_item@meeting_outcome = meeting_outcome || build_meeting_outcome@hidden = hidden-- # binding.pryendprivate@@ -54,5 +52,29 @@ module MeetingAgendaItems::Outcomeskind: 0)end++ def method+ if @meeting_outcome.id.present?+ :put+ else+ :post+ end+ end++ def submit_path+ if @meeting_outcome.id.present?+ meeting_outcome_path(@meeting, @meeting_outcome.id, format: :turbo_stream)+ else+ meeting_outcomes_path(@meeting, meeting_agenda_item_id: @meeting_agenda_item&.id, format: :turbo_stream)+ end+ end++ def cancel_path+ if @meeting_outcome.id.present?+ cancel_edit_meeting_outcome_path(@meeting, @meeting_outcome)+ else+ cancel_new_meeting_outcomes_path(@meeting, meeting_agenda_item_id: @meeting_agenda_item&.id)+ end+ endendenddiff --git a/modules/meeting/app/components/meeting_agenda_items/outcomes/show_notes_component.html.erb b/modules/meeting/app/components/meeting_agenda_items/outcomes/show_notes_component.html.erbnew file mode 100644index 00000000000..824162e8767--- /dev/null+++ b/modules/meeting/app/components/meeting_agenda_items/outcomes/show_notes_component.html.erb@@ -0,0 +1,35 @@+<%=+ component_wrapper do+ render(Primer::Box.new(p: 3, classes: "outcome-container", border_radius: 2)) do+ grid_layout("op-meeting-outcome-notes", tag: :div, id: "item-#{@meeting_outcome.id}") do |grid|+ grid.with_area(:title, tag: :span) do+ render(Primer::Beta::Heading.new(tag: :h5)) { "Outcome" }+ end++ grid.with_area(:content, tag: :div) do+ render(Primer::Box.new(classes: "op-uc-container", mt: 1)) do+ format_text(@meeting_outcome, :notes)+ end+ end++ grid.with_area(:actions, tag: :div, justify_self: :end, classes: "hide-when-print") do+ if edit_enabled?+ render(Primer::Alpha::ActionMenu.new) do |menu|+ menu.with_show_button(+ icon: "kebab-horizontal",+ "aria-label": I18n.t(:label_agenda_outcome_actions),+ scheme: :invisible,+ ml: 2,+ test_selector: "op-meeting-outcome-actions"+ )+ edit_action_item(menu) if @meeting_outcome.editable?+ copy_action_item(menu)+ menu.with_divider+ delete_action_item(menu)+ end+ end+ end+ end+ end+ end+%>diff --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 d866185a5d1..a8c266de56a 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@@ -31,25 +31,49 @@module MeetingAgendaItemsclass Outcomes::ShowNotesComponent < ApplicationComponentinclude ApplicationHelper+ include OpTurbo::Streamableinclude OpPrimer::ComponentHelpersdef initialize(meeting_outcome:)super@meeting_outcome = meeting_outcome+ @meeting = @meeting_outcome.meeting_agenda_item.meetingend- def call- render(Primer::Box.new(m: 3)) do- component_collection do |collection|- collection.with_component(Primer::Beta::Heading.new(tag: :h5)) do- "Outcome"- end-- collection.with_component(Primer::Box.new(classes: "op-uc-container", mt: 1)) do- format_text(@meeting_outcome, :notes)- end- end+ private++ def edit_enabled?+ @meeting.open? && User.current.allowed_in_project?(:create_meeting_minutes, @meeting.project)+ end++ def edit_action_item(menu)+ menu.with_item(label: t("label_agenda_outcome_edit"),+ href: edit_meeting_outcome_path(@meeting, @meeting_outcome),+ content_arguments: {+ data: { "turbo-stream": true }+ }) do |item|+ item.with_leading_visual_icon(icon: :pencil)+ end+ end++ def copy_action_item(menu)+ url = meeting_url(@meeting, anchor: "item-#{@meeting_outcome.id}")+ menu.with_item(label: t("button_copy_link_to_clipboard"),+ tag: :"clipboard-copy",+ content_arguments: { value: url }) do |item|+ item.with_leading_visual_icon(icon: :copy)+ end+ end++ def delete_action_item(menu)+ menu.with_item(label: t("label_agenda_outcome_delete"),+ scheme: :danger,+ href: "",+ form_arguments: {+ method: :delete, data: { confirm: t("text_are_you_sure"), "turbo-stream": true }+ }) do |item|+ item.with_leading_visual_icon(icon: :trash)endendenddiff --git a/modules/meeting/app/components/meeting_agenda_items/outcomes/show_notes_component.sass b/modules/meeting/app/components/meeting_agenda_items/outcomes/show_notes_component.sassnew file mode 100644index 00000000000..17f860f4c73--- /dev/null+++ b/modules/meeting/app/components/meeting_agenda_items/outcomes/show_notes_component.sass@@ -0,0 +1,13 @@+@import 'helpers'++.outcome-container+ background-color: var(--grid-background-color)++.op-meeting-outcome-notes+ display: grid+ grid-template-columns: auto fit-content(40px)+ grid-template-areas: "title actions" "content ."++++diff --git a/modules/meeting/app/contracts/meeting_outcomes/create_contract.rb b/modules/meeting/app/contracts/meeting_outcomes/create_contract.rbindex f198db6bdad..d667bba0f1b 100644--- a/modules/meeting/app/contracts/meeting_outcomes/create_contract.rb+++ b/modules/meeting/app/contracts/meeting_outcomes/create_contract.rb@@ -28,28 +28,9 @@module MeetingOutcomesclass CreateContract < BaseContract-validate :user_allowed_to_add, :validate_meeting_existence- # def self.assignable_meetings(user)- # StructuredMeeting- # .open- # .not_templated- # .not_cancelled- # .visible(user)- # end-- ##- # Meeting agenda items can currently be only created- # through the project permission :manage_agendas- # When MeetingRole becomes available, agenda items will- # be created through meeting permissions :manage_agendasdef user_allowed_to_add- binding.pry- # when creating a meeting agenda item from the work package tab and not selecting a meeting- # the meeting and therefore the project is not set- # in this case we only want to show the "Meeting can't be blank" error instead of a misleading permission base error- # the error is added by the models presence validationreturn unless visible?unless user.allowed_in_project?(:create_meeting_minutes, model.meeting_agenda_item.project)@@ -57,14 +38,7 @@ module MeetingOutcomesendend- ##- # A stale browser window might provide an already deleted meeting as an option when creating an agenda item from the- # work package tab. This would lead to an 500 server error when trying to save the agenda item.def validate_meeting_existence- # when creating a meeting agenda item from the work package tab and not selecting a meeting- # the meeting and therefore the project is not set- # in this case we only want to show the "Meeting can't be blank" error instead of a misleading not existance error- # the error is added by the models presence validationreturn if model.meeting_agenda_item.meeting.nil?errors.add :base, :does_not_exist unless visible?diff --git a/modules/meeting/app/contracts/meeting_outcomes/update_contract.rb b/modules/meeting/app/contracts/meeting_outcomes/update_contract.rbnew file mode 100644index 00000000000..da3b5e5219c--- /dev/null+++ b/modules/meeting/app/contracts/meeting_outcomes/update_contract.rb@@ -0,0 +1,41 @@+# frozen_string_literal: true++#-- 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 UpdateContract < BaseContract+ validate :user_allowed_to_edit++ def user_allowed_to_edit+ unless user.allowed_in_project?(:create_meeting_minutes, model.meeting_agenda_item.project)+ errors.add :base, :error_unauthorized+ end+ end+ end+enddiff --git a/modules/meeting/app/controllers/concerns/meetings/agenda_component_streams.rb b/modules/meeting/app/controllers/concerns/meetings/agenda_component_streams.rbindex 421fc9c5167..7e3c6381ee0 100644--- a/modules/meeting/app/controllers/concerns/meetings/agenda_component_streams.rb+++ b/modules/meeting/app/controllers/concerns/meetings/agenda_component_streams.rb@@ -142,7 +142,7 @@ module Meetingsdef render_agenda_item_form_via_turbo_stream(meeting: @meeting, meeting_section: @meeting_section, type: :simple)if meeting.sections.empty?- render_agenda_item_form_for_empty_meeting_via_turbo_stream(meeting:, type:)+ render_agenda_item_form_for_empty_meeting_via_turbo_stream(type:)elserender_agenda_item_form_in_section_via_turbo_stream(meeting:, meeting_section:, type:)end@@ -150,7 +150,7 @@ module Meetingsupdate_new_button_via_turbo_stream(disabled: true)end- def render_agenda_item_form_for_empty_meeting_via_turbo_stream(meeting: @meeting, type: :simple)+ def render_agenda_item_form_for_empty_meeting_via_turbo_stream(type: :simple)update_new_component_via_turbo_stream(hidden: false,meeting_section: nil,@@ -175,16 +175,12 @@ module Meetingsenddef render_outcome_form_via_turbo_stream(meeting: @meeting, meeting_agenda_item: @meeting_agenda_item)- # binding.pryrender_base_outcome_component_via_turbo_stream(meeting:, meeting_agenda_item:, hide_notes: false, meeting_outcome: nil,state: :edit)-- # update_new_outcome_button_via_turbo_stream(disabled: true)end- def render_base_outcome_component_via_turbo_stream(meeting_outcome:, state:, hide_notes:, meeting: @meeting,+ def render_base_outcome_component_via_turbo_stream(hide_notes:, meeting_outcome: nil, state: :show, meeting: @meeting,meeting_agenda_item: @meeting_agenda_item)- # binding.pryupdate_via_turbo_stream(component: MeetingAgendaItems::Outcomes::BaseComponent.new(hide_notes:,@@ -196,16 +192,6 @@ module Meetings)end- # def update_new_outcome_component_via_turbo_stream(hidden: false, meeting_agenda_item: @meeting_agenda_item, meeting: @meeting)- # update_via_turbo_stream(- # component: MeetingAgendaItems::Outcomes::BaseComponent.new(- # hide_notes:- # meeting:,- # meeting_agenda_item:- # )- # )- # end-def update_new_outcome_button_via_turbo_stream(disabled: false, meeting: @meeting,meeting_agenda_item: @meeting_agenda_item)update_via_turbo_stream(diff --git a/modules/meeting/app/controllers/meeting_agenda_items_controller.rb b/modules/meeting/app/controllers/meeting_agenda_items_controller.rbindex ca2fa51cb43..6a9547f4dd0 100644--- a/modules/meeting/app/controllers/meeting_agenda_items_controller.rb+++ b/modules/meeting/app/controllers/meeting_agenda_items_controller.rb@@ -80,7 +80,6 @@ class MeetingAgendaItemsController < ApplicationController@meeting_agenda_item = call.result- binding.pryif call.success?reset_meeting_from_agenda_item# enable continue editingdiff --git a/modules/meeting/app/controllers/meeting_outcomes_controller.rb b/modules/meeting/app/controllers/meeting_outcomes_controller.rbindex 3726893f553..ee081910b5f 100644--- a/modules/meeting/app/controllers/meeting_outcomes_controller.rb+++ b/modules/meeting/app/controllers/meeting_outcomes_controller.rb@@ -1,3 +1,5 @@+# frozen_string_literal: true+#-- copyright# OpenProject is an open source project management software.# Copyright (C) the OpenProject GmbH@@ -32,12 +34,12 @@ class MeetingOutcomesController < ApplicationControllerinclude Meetings::AgendaComponentStreamsbefore_action :set_meeting- before_action :set_meeting_agenda_item+ before_action :set_meeting_agenda_item, except: %i[edit cancel_edit update]+ 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]def new- # binding.pryif @meeting.open?render_outcome_form_via_turbo_stream(meeting: @meeting, meeting_agenda_item: @meeting_agenda_item)else@@ -50,12 +52,11 @@ class MeetingOutcomesController < ApplicationControllerdef cancel_newrender_base_outcome_component_via_turbo_stream(meeting: @meeting, meeting_agenda_item: @meeting_agenda_item, hide_notes: true)- # update_new_button_via_turbo_stream(disabled: false)respond_with_turbo_streamsend- def create # rubocop:disable Metrics/AbcSize+ def createcall = ::MeetingOutcomes::CreateService.new(user: current_user).call(@@ -64,110 +65,56 @@ class MeetingOutcomesController < ApplicationController)@meeting_outcome = call.result- # binding.pry+if call.success?- render_base_outcome_component_via_turbo_stream(meeting: @meeting, meeting_agenda_item: @meeting_agenda_item, meeting_outcome: @meeting_outcome, hide_notes: false, state: :show)- else- # show errors- update_new_component_via_turbo_stream(- hidden: false, meeting_agenda_item: @meeting_agenda_item, type: @agenda_item_type- )- render_base_error_in_flash_message_via_turbo_stream(call.errors)+ render_base_outcome_component_via_turbo_stream(meeting: @meeting, meeting_agenda_item: @meeting_agenda_item,+ meeting_outcome: @meeting_outcome, hide_notes: false, state: :show)+ # else+ # # show errors+ # update_new_component_via_turbo_stream(+ # hidden: false, meeting_agenda_item: @meeting_agenda_item, type: @agenda_item_type+ # )+ # render_base_error_in_flash_message_via_turbo_stream(call.errors)endrespond_with_turbo_streamsenddef edit- if @meeting_agenda_item.editable?- update_item_via_turbo_stream(state: :edit, display_notes_input: params[:display_notes_input])- else- update_all_via_turbo_stream- render_error_flash_message_via_turbo_stream(message: t("text_meeting_not_editable_anymore"))+ if @meeting_outcome.editable?+ @meeting_agenda_item = @meeting_outcome.meeting_agenda_item+ # render_outcome_form_via_turbo_stream(meeting: @meeting, meeting_agenda_item: @meeting_agenda_item)+ render_base_outcome_component_via_turbo_stream(meeting: @meeting, meeting_agenda_item: @meeting_agenda_item,+ meeting_outcome: @meeting_outcome, hide_notes: false, state: :edit)+ # else+ # update_all_via_turbo_stream+ # render_error_flash_message_via_turbo_stream(message: t("text_meeting_not_editable_anymore"))endrespond_with_turbo_streamsenddef cancel_edit- update_item_via_turbo_stream(state: :show)+ @meeting_agenda_item = @meeting_outcome.meeting_agenda_item+ render_base_outcome_component_via_turbo_stream(meeting: @meeting, meeting_agenda_item: @meeting_agenda_item,+ meeting_outcome: @meeting_outcome, hide_notes: false, state: :show)respond_with_turbo_streamsenddef update- call = ::MeetingAgendaItems::UpdateService- .new(user: current_user, model: @meeting_agenda_item)- .call(meeting_agenda_item_params)-- if call.success?- reset_meeting_from_agenda_item- update_item_via_turbo_stream- update_section_header_via_turbo_stream(meeting_section: @meeting_agenda_item.meeting_section)- update_header_component_via_turbo_stream- update_sidebar_details_component_via_turbo_stream- else- # show errors- update_item_via_turbo_stream(state: :edit)- render_base_error_in_flash_message_via_turbo_stream(call.errors)- end-- respond_with_turbo_streams- end-- def destroy- section = @meeting_agenda_item.meeting_section-- call = ::MeetingAgendaItems::DeleteService- .new(user: current_user, model: @meeting_agenda_item)- .call-- if call.success?- reset_meeting_from_agenda_item- remove_item_via_turbo_stream(clear_slate: @meeting.agenda_items.empty?)- update_header_component_via_turbo_stream- update_section_header_via_turbo_stream(meeting_section: section) if section&.reload.present?- update_sidebar_details_component_via_turbo_stream- else- generic_call_failure_response(call)- end-- respond_with_turbo_streams- end-- def drop- call = ::MeetingAgendaItems::DropService.new(- user: current_user, meeting_agenda_item: @meeting_agenda_item- ).call(- target_id: params[:target_id],- position: params[:position]- )-- if call.success?- if call.result[:section_changed]- move_item_to_other_section_via_turbo_stream(- old_section: call.result[:old_section],- current_section: call.result[:current_section]- )- else- move_item_within_section_via_turbo_stream- end- else- generic_call_failure_response(call)- end-- respond_with_turbo_streams- end-- def move- call = ::MeetingAgendaItems::UpdateService- .new(user: current_user, model: @meeting_agenda_item)- .call(move_to: params[:move_to]&.to_sym)+ @meeting_agenda_item = @meeting_outcome.meeting_agenda_item+ call = ::MeetingOutcomes::UpdateService+ .new(user: current_user, model: @meeting_outcome)+ .call(+ meeting_agenda_item: @meeting_agenda_item,+ notes: params[:meeting_outcome][:outcome]+ )if call.success?- move_item_within_section_via_turbo_stream- else- generic_call_failure_response(call)+ render_base_outcome_component_via_turbo_stream(meeting: @meeting, meeting_agenda_item: @meeting_agenda_item,+ meeting_outcome: call.result, hide_notes: false, state: :show)+ # elseendrespond_with_turbo_streams@@ -176,28 +123,16 @@ class MeetingOutcomesController < ApplicationControllerprivatedef set_meeting- # binding.pry@meeting = Meeting.find(params[:meeting_id])@project = @meeting.project # required for authorization via before_actionend- # In case we updated the meeting as part of the service flow- # it needs to be reassigned for the controller in order to get correct timestamps- def reset_meeting_from_agenda_item- @meeting = @meeting_agenda_item.meeting- end-- def set_agenda_item_type- @agenda_item_type = params[:type]&.to_sym- end-def set_meeting_agenda_item- # binding.pry@meeting_agenda_item = MeetingAgendaItem.find(params[:meeting_agenda_item_id])end- def set_agenda_item_outcome- #TODO+ def set_meeting_outcome+ @meeting_outcome = MeetingOutcome.find(params[:id])enddef generic_call_failure_response(call)diff --git a/modules/meeting/app/forms/meeting_agenda_item/notes.rb b/modules/meeting/app/forms/meeting_agenda_item/notes.rbindex a5c5f76dbbf..3114a81659f 100644--- a/modules/meeting/app/forms/meeting_agenda_item/notes.rb+++ b/modules/meeting/app/forms/meeting_agenda_item/notes.rb@@ -37,7 +37,7 @@ class MeetingAgendaItem::Notes < ApplicationFormdisabled: @disabled,classes: "ck-editor-primer-adjusted",rich_text_options: {- # resource:,+ resource:,showAttachments: false})diff --git a/modules/meeting/app/forms/meeting_agenda_item/outcome/notes.rb b/modules/meeting/app/forms/meeting_agenda_item/outcome/notes.rbindex de32d28210e..d02af66235f 100644--- a/modules/meeting/app/forms/meeting_agenda_item/outcome/notes.rb+++ b/modules/meeting/app/forms/meeting_agenda_item/outcome/notes.rb@@ -45,7 +45,6 @@ class MeetingAgendaItem::Outcome::Notes < ApplicationFormdef initialize(disabled: false)@disabled = disabled- # binding.pryenddef resourcediff --git a/modules/meeting/app/models/meeting_outcome.rb b/modules/meeting/app/models/meeting_outcome.rbindex f284043a366..b08bd151b9d 100644--- a/modules/meeting/app/models/meeting_outcome.rb+++ b/modules/meeting/app/models/meeting_outcome.rb@@ -40,4 +40,16 @@ class MeetingOutcome < ApplicationRecordvalidates_presence_of :meeting_agenda_itemvalidates_presence_of :notes, if: -> { information_kind? }validates_presence_of :work_package, if: -> { work_package_kind? }++ # validate :unique_kind++ # def unique_kind+ # if meeting_agenda_item.outcomes.exists?(kind: kind)+ # errors.add(:kind, "has already been taken for this MeetingAgenda")+ # end+ # end++ def editable?+ !meeting_agenda_item.meeting&.closed?+ endenddiff --git a/modules/meeting/app/services/meeting_outcomes/update_service.rb b/modules/meeting/app/services/meeting_outcomes/update_service.rbnew file mode 100644index 00000000000..f61ce1cbb7c--- /dev/null+++ b/modules/meeting/app/services/meeting_outcomes/update_service.rb@@ -0,0 +1,34 @@+# frozen_string_literal: true++#-- 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 UpdateService < ::BaseServices::Update+ end+enddiff --git a/modules/meeting/config/locales/en.yml b/modules/meeting/config/locales/en.ymlindex 6b7f917d00d..f260cefc795 100644--- a/modules/meeting/config/locales/en.yml+++ b/modules/meeting/config/locales/en.yml@@ -426,6 +426,10 @@ en:label_agenda_item_work_package: "Agenda item work package"+ label_agenda_outcome_actions: "Agenda outcome actions"+ label_agenda_outcome_edit: "Edit outcome"+ label_agenda_outcome_delete: "Remove outcome"+text_agenda_item_title: 'Agenda item "%{title}"'text_agenda_work_package_deleted: 'Agenda item for deleted work package'text_deleted_agenda_item: 'Deleted agenda item'diff --git a/modules/meeting/config/routes.rb b/modules/meeting/config/routes.rbindex dbb6b42ad8f..e69ce8f8942 100644--- a/modules/meeting/config/routes.rb+++ b/modules/meeting/config/routes.rb@@ -124,7 +124,7 @@ Rails.application.routes.draw doget :cancel_newendmember do- # get :cancel_edit+ get :cancel_edit# put :drop# put :moveend