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

more specific UI updates when removing sections

Jonas Jabaria97ccfcf0c5c
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 005f8520744..2f92c705fe6 100644
--- a/modules/meeting/app/controllers/concerns/meetings/agenda_component_streams.rb
+++ b/modules/meeting/app/controllers/concerns/meetings/agenda_component_streams.rb
@@ -301,6 +301,19 @@ module Meetings
)
end
+ def remove_section_via_turbo_stream(meeting_section: @meeting_section)
+ if meeting_section.meeting.sections.count == 0
+ # show blank slate again through rerendering the list component
+ update_list_via_turbo_stream
+ else
+ remove_via_turbo_stream(
+ component: MeetingSections::ShowComponent.new(
+ meeting_section:
+ )
+ )
+ end
+ end
+
def update_all_via_turbo_stream
update_header_component_via_turbo_stream
update_sidebar_component_via_turbo_stream
diff --git a/modules/meeting/app/controllers/meeting_sections_controller.rb b/modules/meeting/app/controllers/meeting_sections_controller.rb
index e5c58a9759d..c256708c82a 100644
--- a/modules/meeting/app/controllers/meeting_sections_controller.rb
+++ b/modules/meeting/app/controllers/meeting_sections_controller.rb
@@ -37,25 +37,6 @@ class MeetingSectionsController < ApplicationController
except: %i[create]
before_action :authorize
- # def new
- # if @meeting.open?
- # update_new_component_via_turbo_stream(hidden: false, type: @agenda_item_type)
- # update_new_button_via_turbo_stream(disabled: true)
- # else
- # update_all_via_turbo_stream
- # render_error_flash_message_via_turbo_stream(message: t("text_meeting_not_editable_anymore"))
- # end
-
- # respond_with_turbo_streams
- # end
-
- # def cancel_new
- # update_new_component_via_turbo_stream(hidden: true)
- # update_new_button_via_turbo_stream(disabled: false)
-
- # respond_with_turbo_streams
- # end
-
def create
call = ::MeetingSections::CreateService
.new(user: current_user)
@@ -127,7 +108,7 @@ class MeetingSectionsController < ApplicationController
.call
if call.success?
- update_all_via_turbo_stream # TODO: more specific UI update
+ remove_section_via_turbo_stream
else
generic_call_failure_response(call)
end