Spike workflows

This commit is contained in:
Jose Farias
2024-10-21 15:33:30 -06:00
parent b1f5498914
commit b0565fbf20
35 changed files with 397 additions and 42 deletions
+43
View File
@@ -0,0 +1,43 @@
class WorkflowsController < ApplicationController
before_action :set_workflow, only: %i[ show edit update destroy ]
def index
@workflows = Current.account.workflows
end
def new
@workflow = Current.account.workflows.new
end
def create
@workflow = Current.account.workflows.create! workflow_params
# FIXME: this should definitely change.
%w[ Triage WIP On-hold ].each { |name| @workflow.stages.create! name: name }
redirect_to account_workflows_path
end
def show
end
def edit
end
def update
@workflow.update! workflow_params
redirect_to account_workflow_path(@workflow)
end
def destroy
@workflow.destroy
redirect_to account_workflows_path
end
private
def set_workflow
@workflow = Current.account.workflows.find params[:id]
end
def workflow_params
params.require(:workflow).permit(:name)
end
end