Task status model rework

Replaced categories with colors, icons and positions
This commit is contained in:
2026-04-06 02:30:33 +03:00
parent 138f1c42a0
commit 9766430e69
20 changed files with 74 additions and 25 deletions
@@ -3,6 +3,16 @@
module Tasks
module Statuses
class SelectorViewModel
ICONS = {
new: 'add_circle_fill',
archived: 'archive_line',
done: 'checks_line',
circle_dash: 'circle_dash_line',
hammer: 'hammer_fill',
play: 'play_circle_fill',
tool: 'tool_line'
}.freeze
def initialize(task, with_form: false)
@task = task
@with_form = with_form
@@ -25,15 +35,19 @@ module Tasks
private
def workflow_task_statuses
@task.workflow.task_statuses.sort_by { |e| [e.category, e.name] }
@task.workflow.task_statuses.sort_by { |e| [e.position, e.name] }
end
def task_status_badge(status, view_context)
view_context.content_tag(
:span, status.name,
class: ['badge', 'task-status', status.category.dasherize]
:span, view_context.mask_icon(icon(status)) + status.name,
class: ['badge', 'task-status', status.color]
)
end
def icon(status)
ICONS.fetch(status.icon.to_sym)
end
end
end
end