diff --git a/app/components/projects/status_button_component.rb b/app/components/projects/status_button_component.rb index 9f65820251a..6d2fa2b5635 100644 --- a/app/components/projects/status_button_component.rb +++ b/app/components/projects/status_button_component.rb @@ -74,7 +74,7 @@ class Projects::StatusButtonComponent < ApplicationComponent icon: status.icon, item_id: status.id, tag: :a, - href: project_status_path(project, status_code: status.value), + href: project_status_path(project, status_code: status.value, status_size: @size), content_arguments: { data: { turbo_method: status.value ? :put : :delete }, aria: { current: (true if status == @status) } diff --git a/app/controllers/projects/status_controller.rb b/app/controllers/projects/status_controller.rb index 8942b9316fd..96d74bc6ccf 100644 --- a/app/controllers/projects/status_controller.rb +++ b/app/controllers/projects/status_controller.rb @@ -63,7 +63,17 @@ class Projects::StatusController < ApplicationController def respond_with_update_status_button message = t(:notice_successful_update) - update_via_turbo_stream(component: Projects::StatusButtonComponent.new(project: @project, user: current_user)) + + # Some views send a size parameter to adjust the status button size, keep that in + # mind when refreshing the component via turbo stream: + size = params[:status_size]&.to_sym + component_options = { + project: @project, + user: current_user, + size: + }.compact + + update_via_turbo_stream(component: Projects::StatusButtonComponent.new(**component_options)) render_success_flash_message_via_turbo_stream(message:) respond_with_turbo_streams do |format| fallback_responses_for(format, flash: { notice: message })