Files
fizzy/app/controllers/collections/workflows_controller.rb
T
Mike Dalessio 988b20a36d Introduce turbo_stream_flash helper and use it for collection edit
The collections/{entropy,publications,workflows} controllers all
respond via turbo stream, and now also provide a flash message.
2025-08-07 15:04:45 -04:00

20 lines
571 B
Ruby

class Collections::WorkflowsController < ApplicationController
include CollectionScoped
before_action :set_workflow
def update
@collection.update! workflow: @workflow
render turbo_stream: [
turbo_stream.replace([ @collection, :workflows ], partial: "collections/edit/workflows", locals: { collection: @collection }),
turbo_stream_flash(notice: "Saved")
]
end
private
def set_workflow
workflow_id = params[:collection][:workflow_id]
@workflow = workflow_id.present? ? Workflow.find(workflow_id) : nil
end
end