diff --git a/app/controllers/collections/workflows_controller.rb b/app/controllers/collections/workflows_controller.rb index a24e646ee..fd503473c 100644 --- a/app/controllers/collections/workflows_controller.rb +++ b/app/controllers/collections/workflows_controller.rb @@ -5,7 +5,7 @@ class Collections::WorkflowsController < ApplicationController def update @collection.update! workflow: @workflow - redirect_to edit_collection_path(@collection), notice: "Collection updated" + render turbo_stream: turbo_stream.replace([ @collection, :workflows ], partial: "collections/edit/workflows", locals: { collection: @collection }) end private diff --git a/app/views/collections/edit/_workflows.html.erb b/app/views/collections/edit/_workflows.html.erb index 1b6154415..73d36de66 100644 --- a/app/views/collections/edit/_workflows.html.erb +++ b/app/views/collections/edit/_workflows.html.erb @@ -1,21 +1,23 @@ -Workflows -
<%= link_to "Manage workflows", workflows_path, class: "btn btn--plain txt-link" %>
+<%= turbo_frame_tag @collection, :workflows do %> + Workflows +<%= link_to "Manage workflows", workflows_path, class: "btn btn--plain txt-link" %>
+<% end %> diff --git a/test/controllers/collections/workflows_controller_test.rb b/test/controllers/collections/workflows_controller_test.rb index 68a85b956..e4e739720 100644 --- a/test/controllers/collections/workflows_controller_test.rb +++ b/test/controllers/collections/workflows_controller_test.rb @@ -10,7 +10,7 @@ class Collections::WorkflowsControllerTest < ActionDispatch::IntegrationTest patch collection_workflow_path(collection), params: { collection: { workflow_id: workflows(:on_call).id } } - assert_redirected_to edit_collection_path(collection) + assert_turbo_stream action: :replace, target: dom_id(collection, :workflows) assert_equal workflows(:on_call), collection.reload.workflow end end