Remove anemic concern
Colors are a card concern.
This commit is contained in:
@@ -10,6 +10,6 @@ module WorkflowsHelper
|
||||
end
|
||||
|
||||
def stage_color(stage)
|
||||
stage.color.presence || Colorable::DEFAULT_COLOR
|
||||
stage.color.presence || Card::DEFAULT_COLOR
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
module Card::Colored
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
COLORS = %w[ #3b3633 #67695e #eb7a32 #bf7c2b #c09c6f #746b1e #2c6da8 #5d618f #663251 #ff63a8 ]
|
||||
DEFAULT_COLOR = "#2c6da8"
|
||||
|
||||
def color
|
||||
color_from_stage || Colorable::DEFAULT_COLOR
|
||||
color_from_stage || DEFAULT_COLOR
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
module Colorable
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
COLORS = %w[ #3b3633 #67695e #eb7a32 #bf7c2b #c09c6f #746b1e #2c6da8 #5d618f #663251 #ff63a8 ]
|
||||
DEFAULT_COLOR = "#2c6da8"
|
||||
end
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<dialog class="color-picker panel fill-white shadow gap-half" data-dialog-target="dialog" data-action="keydown.esc->dialog#close click@document->dialog#closeOnClickOutside">
|
||||
<%= 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| %>
|
||||
<% Card::COLORS.each do |color| %>
|
||||
<span class="color-picker__color">
|
||||
<label class="btn btn--circle" style="--btn-background: <%= color %>" title="<%= color %>">
|
||||
<%= form.radio_button :color, color %>
|
||||
|
||||
@@ -2,11 +2,11 @@ require "test_helper"
|
||||
|
||||
class Card::ColoredTest < ActiveSupport::TestCase
|
||||
test "use default color no stage" do
|
||||
assert_equal Colorable::DEFAULT_COLOR, cards(:logo).color
|
||||
assert_equal Card::DEFAULT_COLOR, cards(:logo).color
|
||||
end
|
||||
|
||||
test "use default color not in doing stage" do
|
||||
assert_equal Colorable::DEFAULT_COLOR, cards(:text).color
|
||||
assert_equal Card::DEFAULT_COLOR, cards(:text).color
|
||||
end
|
||||
|
||||
test "infer color from stage when in doing stage" do
|
||||
|
||||
Reference in New Issue
Block a user