initial commit

This commit is contained in:
Alex Turchyn
2023-05-21 17:59:36 +03:00
commit 97c462ead2
159 changed files with 10987 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
# 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