diff --git a/app/models/card.rb b/app/models/card.rb index 8baefc79a..50f2f541b 100644 --- a/app/models/card.rb +++ b/app/models/card.rb @@ -1,5 +1,5 @@ class Card < ApplicationRecord - include Assignable, Boostable, Commentable, Engageable, Eventable, + include Assignable, Boostable, Colored, Commentable, Engageable, Eventable, Messages, Notifiable, Pinnable, Closeable, Scorable, Searchable, Staged, Statuses, Taggable, Watchable belongs_to :collection, touch: true @@ -33,14 +33,6 @@ class Card < ApplicationRecord [ super, collection&.name ].compact.join("/") end - def color - return Colorable::DEFAULT_COLOR unless collection&.workflow.present? - return Colorable::DEFAULT_COLOR unless doing? - return Colorable::DEFAULT_COLOR unless stage.present? - - stage.color.presence || Colorable::DEFAULT_COLOR - end - private def track_due_date_change if due_on.present? diff --git a/app/models/card/colored.rb b/app/models/card/colored.rb new file mode 100644 index 000000000..99e934a94 --- /dev/null +++ b/app/models/card/colored.rb @@ -0,0 +1,12 @@ +module Card::Colored + extend ActiveSupport::Concern + + def color + color_from_stage || Colorable::DEFAULT_COLOR + end + + private + def color_from_stage + stage&.color&.presence if doing? + end +end