diff --git a/app/controllers/workflows/stages_controller.rb b/app/controllers/workflows/stages_controller.rb index c85016dcc..f6422f9d6 100644 --- a/app/controllers/workflows/stages_controller.rb +++ b/app/controllers/workflows/stages_controller.rb @@ -31,6 +31,6 @@ class Workflows::StagesController < ApplicationController end def stage_params - params.expect workflow_stage: [ :name ] + params.require(:workflow_stage).permit(:name, :color) end end diff --git a/app/helpers/workflows_helper.rb b/app/helpers/workflows_helper.rb index 32fd5e68a..f54da0757 100644 --- a/app/helpers/workflows_helper.rb +++ b/app/helpers/workflows_helper.rb @@ -9,4 +9,8 @@ module WorkflowsHelper end end end + + def stage_color(stage) + stage.color.presence || "#2c6da8" + end end diff --git a/app/views/workflows/stages/_color.html.erb b/app/views/workflows/stages/_color.html.erb new file mode 100644 index 000000000..fc0b65b6e --- /dev/null +++ b/app/views/workflows/stages/_color.html.erb @@ -0,0 +1,27 @@ +
+ + + + <%= form_with model: stage, url: workflow_stage_path(stage.workflow, stage), class: "flex gap-half", data: { controller: "form", action: "change->form#submit" } do |form| %> + <% Colorable::COLORS.each do |color| %> + + + + <% end %> + <% end %> + +
+ +
+
+
\ No newline at end of file diff --git a/app/views/workflows/stages/_stage.html.erb b/app/views/workflows/stages/_stage.html.erb index 21cf0cf0b..9d68de0b3 100644 --- a/app/views/workflows/stages/_stage.html.erb +++ b/app/views/workflows/stages/_stage.html.erb @@ -1,7 +1,9 @@ -
+
+ <%= render "workflows/stages/color", stage: stage %> + <%= turbo_frame_tag stage do %> <%= link_to edit_workflow_stage_path(stage.workflow, stage) do %> <%= stage.name %> <% end %> <% end %> -
+
\ No newline at end of file