mirror of https://github.com/docusealco/docuseal
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
861 B
37 lines
861 B
# frozen_string_literal: true
|
|
|
|
class FlowsController < ApplicationController
|
|
def show
|
|
@flow = current_account.flows.preload(documents_attachments: { preview_images_attachments: :blob })
|
|
.find(params[:id])
|
|
end
|
|
|
|
def new
|
|
@flow = current_account.flows.new
|
|
end
|
|
|
|
def create
|
|
@flow = current_account.flows.new(flow_params)
|
|
@flow.author = current_user
|
|
|
|
if @flow.save
|
|
redirect_to flow_path(@flow)
|
|
else
|
|
render turbo_stream: turbo_stream.replace(:modal, template: 'flows/new'), status: :unprocessable_entity
|
|
end
|
|
end
|
|
|
|
def destroy
|
|
@flow = current_account.flows.find(params[:id])
|
|
@flow.update!(deleted_at: Time.current)
|
|
|
|
redirect_to settings_users_path, notice: 'Flow has been archived.'
|
|
end
|
|
|
|
private
|
|
|
|
def flow_params
|
|
params.require(:flow).permit(:name, :schema)
|
|
end
|
|
end
|