Skip to content

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

Make the Meeting Agenda Item move action to replace individual elements only.

Dombi Attilad4c4261d2a8c
diff --git a/modules/meeting/app/controllers/concerns/meetings/agenda_component_streams.rb b/modules/meeting/app/controllers/concerns/meetings/agenda_component_streams.rb
index 2dc103e2cc8..4865f53cb97 100644
--- a/modules/meeting/app/controllers/concerns/meetings/agenda_component_streams.rb
+++ b/modules/meeting/app/controllers/concerns/meetings/agenda_component_streams.rb
@@ -146,6 +146,7 @@ module Meetings
update_list_via_turbo_stream(form_hidden: false, form_type: @agenda_item_type)
else
update_new_component_via_turbo_stream(hidden: false, type: @agenda_item_type)
+ update_list_dropdown_menu_via_turbo_stream
add_before_via_turbo_stream(
component: MeetingAgendaItems::ItemComponent.new(
state: :show,
@@ -160,6 +161,7 @@ module Meetings
if clear_slate
update_list_via_turbo_stream
else
+ update_list_dropdown_menu_via_turbo_stream
remove_via_turbo_stream(
component: MeetingAgendaItems::ItemComponent.new(
state: :show,
@@ -169,6 +171,27 @@ module Meetings
end
end
+ def move_item_via_turbo_stream(meeting_agenda_item: @meeting_agenda_item)
+ update_list_dropdown_menu_via_turbo_stream
+ # Note: The `remove_component` and the `component` are pointing to the same
+ # component, but we still need to instantiate them separately, otherwise re-adding
+ # of the item will render and empty component.
+ remove_component = MeetingAgendaItems::ItemComponent.new(state: :show, meeting_agenda_item:)
+ remove_via_turbo_stream(component: remove_component)
+
+ component = MeetingAgendaItems::ItemComponent.new(state: :show, meeting_agenda_item:)
+ target_component =
+ if @meeting_agenda_item.lower_item
+ MeetingAgendaItems::ItemComponent.new(
+ state: :show,
+ meeting_agenda_item: @meeting_agenda_item.lower_item
+ )
+ else
+ MeetingAgendaItems::ListComponent.new(meeting: @meeting)
+ end
+ add_before_via_turbo_stream(component:, target_component:)
+ end
+
def render_base_error_in_flash_message_via_turbo_stream(errors)
if errors[:base].present?
render_error_flash_message_via_turbo_stream(message: errors[:base].to_sentence)
diff --git a/modules/meeting/app/controllers/meeting_agenda_items_controller.rb b/modules/meeting/app/controllers/meeting_agenda_items_controller.rb
index c3e67aa9220..a2255747b5f 100644
--- a/modules/meeting/app/controllers/meeting_agenda_items_controller.rb
+++ b/modules/meeting/app/controllers/meeting_agenda_items_controller.rb
@@ -74,7 +74,6 @@ class MeetingAgendaItemsController < ApplicationController
if call.success?
# enable continue editing
add_item_via_turbo_stream(clear_slate:)
- update_list_dropdown_menu_via_turbo_stream
update_header_component_via_turbo_stream
update_sidebar_details_component_via_turbo_stream
else
@@ -130,7 +129,6 @@ class MeetingAgendaItemsController < ApplicationController
if call.success?
remove_item_via_turbo_stream(clear_slate: @meeting.agenda_items.empty?)
- update_list_dropdown_menu_via_turbo_stream
update_header_component_via_turbo_stream
update_sidebar_details_component_via_turbo_stream
else
@@ -161,7 +159,7 @@ class MeetingAgendaItemsController < ApplicationController
.call(move_to: params[:move_to]&.to_sym)
if call.success?
- update_item_via_turbo_stream
+ move_item_via_turbo_stream
update_header_component_via_turbo_stream
else
generic_call_failure_response(call)