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 new backlog related agenda item actions
Mir Bhatia21ab82f78339
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 563231b3eda..ef89cf42b1c 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@@ -65,20 +65,27 @@ml: 2,test_selector: "op-meeting-agenda-actions")+edit_action_item(menu) if @meeting_agenda_item.editable?add_note_action_item(menu) if @meeting_agenda_item.editable? && @meeting_agenda_item.notes.blank?+menu.with_divider if add_outcome_action?add_outcome_action_item(menu) if add_outcome_action?+unless first? && last?menu.with_dividermove_actions(menu)end-++ menu.with_divider+ move_to_current_meeting_action_item(menu) if in_backlog?+ move_to_backlog_action_item(menu) if !in_backlog?+if move_to_next_meeting_enabled?menu.with_dividermove_to_next_meeting_action_item(menu)end-+menu.with_dividercopy_action_item(menu)menu.with_dividerdiff --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 5297f93cc8f..b974a8b89ad 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@@ -186,6 +186,26 @@ module MeetingAgendaItemsendend+ def move_to_backlog_action_item(menu)+ menu.with_item(label: I18n.t(:label_agenda_item_move_to_backlog),+ href: drop_meeting_agenda_item_path(@meeting_agenda_item.meeting, @meeting_agenda_item, type: :to_backlog),+ form_arguments: {+ method: :put, data: { "turbo-stream": true }+ }) do |item|+ item.with_leading_visual_icon(icon: "discussion-outdated")+ end+ end++ def move_to_current_meeting_action_item(menu)+ menu.with_item(label: I18n.t(:label_agenda_item_move_to_current_meeting),+ href: drop_meeting_agenda_item_path(@meeting_agenda_item.meeting, @meeting_agenda_item, type: :to_current),+ form_arguments: {+ method: :put, data: { "turbo-stream": true }+ }) do |item|+ item.with_leading_visual_icon(icon: "cross-reference")+ end+ end+def duration_color_schemeif @meeting.end_time < @meeting_agenda_item.end_time:danger@@ -205,5 +225,9 @@ module MeetingAgendaItemsdef move_to_next_meeting_enabled?edit_enabled? && @meeting.recurring? && @meeting.recurring_meeting&.next_occurrence.present?end++ def in_backlog?+ @meeting_agenda_item.meeting_section == @meeting.backlog+ endendenddiff --git a/modules/meeting/app/components/meeting_agenda_items/list_component.rb b/modules/meeting/app/components/meeting_agenda_items/list_component.rbindex 31a2f064bf4..0814c2d531a 100644--- a/modules/meeting/app/components/meeting_agenda_items/list_component.rb+++ b/modules/meeting/app/components/meeting_agenda_items/list_component.rb@@ -43,7 +43,7 @@ module MeetingAgendaItemsenddef empty?- @meeting.agenda_items.empty? && @meeting.sections.empty?+ @meeting.agenda_items.reject { |item| item.meeting_section&.backlog? }.empty? && @meeting.sections.empty?endprivatediff --git a/modules/meeting/app/components/meeting_sections/backlogs/container_component.rb b/modules/meeting/app/components/meeting_sections/backlogs/container_component.rbindex 8b5bedfc270..16556c6b76e 100644--- a/modules/meeting/app/components/meeting_sections/backlogs/container_component.rb+++ b/modules/meeting/app/components/meeting_sections/backlogs/container_component.rb@@ -37,7 +37,6 @@ module MeetingSectionsdef initialize(meeting:)super- # binding.pry@meeting = meeting@backlog = meeting.backlogenddiff --git a/modules/meeting/app/components/meeting_sections/backlogs/header_component.rb b/modules/meeting/app/components/meeting_sections/backlogs/header_component.rbindex 8b2f7c6cfd4..b2ed8fccb2b 100644--- a/modules/meeting/app/components/meeting_sections/backlogs/header_component.rb+++ b/modules/meeting/app/components/meeting_sections/backlogs/header_component.rb@@ -37,7 +37,6 @@ module MeetingSectionsdef initialize(backlog:, box: nil)super- # binding.pry@backlog = backlog@meeting = backlog.meeting@box = boxdiff --git a/modules/meeting/app/components/meeting_sections/show_component.rb b/modules/meeting/app/components/meeting_sections/show_component.rbindex 1886f7add28..146de096ddd 100644--- a/modules/meeting/app/components/meeting_sections/show_component.rb+++ b/modules/meeting/app/components/meeting_sections/show_component.rb@@ -40,7 +40,6 @@ module MeetingSectionsforce_wrapper: false, state: :show, collapsed: false)super- # binding.pry@meeting = meeting_section.meeting@meeting_section = meeting_section@meeting_agenda_items = meeting_section.agenda_itemsdiff --git a/modules/meeting/app/controllers/concerns/meetings/agenda_component_streams.rb b/modules/meeting/app/controllers/concerns/meetings/agenda_component_streams.rbindex 2ce98364b4e..feb10de2e06 100644--- a/modules/meeting/app/controllers/concerns/meetings/agenda_component_streams.rb+++ b/modules/meeting/app/controllers/concerns/meetings/agenda_component_streams.rb@@ -216,7 +216,7 @@ module Meetingsdef add_item_via_turbo_stream(meeting_agenda_item: @meeting_agenda_item, clear_slate: false) # rubocop:disable Metrics/AbcSizeif clear_slateupdate_list_via_turbo_stream(form_hidden: false, form_type: @agenda_item_type)- elsif meeting_agenda_item.meeting.agenda_items.count == 1+ elsif meeting_agenda_item.meeting.agenda_items.count == 1 && meeting_agenda_item.meeting.sections.present?update_list_via_turbo_stream(form_hidden: true)update_new_component_via_turbo_stream(@@ -224,7 +224,6 @@ module Meetingsmeeting_section: meeting_agenda_item.meeting_section,type: @agenda_item_type)-elseupdate_section_header_via_turbo_stream(meeting_section: meeting_agenda_item.meeting_section)@@ -358,15 +357,14 @@ module Meetingsenddef update_section_via_turbo_stream(meeting_section: @meeting_section, form_hidden: true, form_type: :simple,- force_wrapper: false, state: :show, expanded: true)+ force_wrapper: false, state: :show)update_via_turbo_stream(component: MeetingSections::ShowComponent.new(meeting_section:,form_type:,form_hidden:,force_wrapper:,- state:,- expanded:+ state:))enddiff --git a/modules/meeting/app/controllers/meeting_agenda_items_controller.rb b/modules/meeting/app/controllers/meeting_agenda_items_controller.rbindex de9e7dae4c1..73aa2ccfee4 100644--- a/modules/meeting/app/controllers/meeting_agenda_items_controller.rb+++ b/modules/meeting/app/controllers/meeting_agenda_items_controller.rb@@ -40,6 +40,7 @@ class MeetingAgendaItemsController < ApplicationControllerexcept: %i[new cancel_new create]before_action :authorizebefore_action :check_recurring_meeting_param, only: %i[move_to_next_meeting]+ before_action :assign_drop_params, only: %i[drop]def newif @meeting.closed?@@ -47,11 +48,7 @@ class MeetingAgendaItemsController < ApplicationControllerrender_error_flash_message_via_turbo_stream(message: t("text_meeting_not_editable_anymore"))elseif params[:meeting_section_id].present?- meeting_section = if params[:meeting_section_id] == @meeting.backlog.id.to_s- @meeting.backlog- else- @meeting.sections.find(params[:meeting_section_id])- end+ meeting_section = MeetingSection.find_by(id: params[:meeting_section_id])endrender_agenda_item_form_via_turbo_stream(meeting_section:, type: @agenda_item_type)end@@ -90,7 +87,7 @@ class MeetingAgendaItemsController < ApplicationControllerif call.success?reset_meeting_from_agenda_item# enable continue editing- add_item_via_turbo_stream(clear_slate: false)+ add_item_via_turbo_stream(clear_slate: @meeting.sections.empty?)update_header_component_via_turbo_streamupdate_sidebar_details_component_via_turbo_streamelse@@ -165,8 +162,8 @@ class MeetingAgendaItemsController < ApplicationControllercall = ::MeetingAgendaItems::DropService.new(user: current_user, meeting_agenda_item: @meeting_agenda_item).call(- target_id: params[:target_id],- position: params[:position]+ target_id: @target_id,+ position: @position)if call.success?@@ -291,4 +288,16 @@ class MeetingAgendaItemsController < ApplicationController@next_occurrence = next_occurrence.meetingendend++ def assign_drop_params # rubocop:disable Metrics/AbcSize+ @target_id, @position =+ if params[:type] == "to_current"+ section = @meeting.sections.order(position: :desc).first+ [section&.id, section&.last_position]+ elsif params[:type] == "to_backlog"+ [@meeting.backlog.id, @meeting.backlog.last_position]+ else+ [params[:target_id], params[:position]]+ end+ endenddiff --git a/modules/meeting/app/models/meeting_section.rb b/modules/meeting/app/models/meeting_section.rbindex 4df867fa142..82005c724ae 100644--- a/modules/meeting/app/models/meeting_section.rb+++ b/modules/meeting/app/models/meeting_section.rb@@ -64,4 +64,12 @@ class MeetingSection < ApplicationRecorddef agenda_items_sum_duration_in_minutesagenda_items.sum(:duration_in_minutes)end++ def last_position+ if agenda_items.empty?+ 1+ else+ agenda_items.maximum(:position) + 1+ end+ endenddiff --git a/modules/meeting/config/locales/en.yml b/modules/meeting/config/locales/en.ymlindex 2e26e8e7209..6f7f76e8dae 100644--- a/modules/meeting/config/locales/en.yml+++ b/modules/meeting/config/locales/en.yml@@ -413,6 +413,8 @@ en:label_agenda_item_deleted_wp: "Deleted work package reference"label_agenda_item_actions: "Agenda items actions"label_agenda_item_move_to_next: "Move to next meeting"+ label_agenda_item_move_to_backlog: "Move to backlog"+ label_agenda_item_move_to_current_meeting: "Move to current meeting"label_agenda_item_move_to_top: "Move to top"label_agenda_item_move_to_bottom: "Move to bottom"label_agenda_item_move_up: "Move up"@@ -429,7 +431,7 @@ en:text_outcome_not_editable_anymore: "This outcome is not editable anymore."label_agenda_backlog: "Agenda backlog"- text_agenda_backlog: "The backlog is shared with all occurrences of this series. You can drag items in and out to add or remove them from a particular meeting. The backlog is only visible when the meeting status is open and hidden once the meeting is in progress."+ text_agenda_backlog: "This backlog is unique to this one-time meeting. You can drag items in and out to add or remove them from the meeting agenda."text_agenda_item_title: 'Agenda item "%{title}"'