Workflow info and update

This commit is contained in:
2026-03-29 14:23:26 +03:00
parent 83b296dbe7
commit 32a7b07f2d
8 changed files with 97 additions and 4 deletions
@@ -2,8 +2,39 @@
module ProjectAdmin
class WorkflowsController < ApplicationController
before_action :fetch_workflow, only: %w[show edit update destroy]
def index
@workflows = @project.workflows
end
def show
# TODO: add loading statuses and other things
end
def edit
@form = ProjectAdmin::Workflows::Update.new(
@workflow.attributes.slice('name', 'icon', 'color')
)
end
def update
@form = ProjectAdmin::Workflows::Update.new(params.expect(workflow: %i[name color icon]))
if @form.perform(@workflow)
redirect_to project_admin_workflow_path(@project, @workflow)
else
render :edit, status: :unprocessable_entity
end
end
def destroy
end
private
def fetch_workflow
@workflow = @project.workflows.find(params[:id])
end
end
end