Refactored task status into a view model

This commit is contained in:
2025-11-25 02:02:39 +02:00
parent 12e10e3afb
commit 5b1744a298
8 changed files with 65 additions and 36 deletions
+2 -13
View File
@@ -9,18 +9,7 @@ module TasksHelper
'Tasks'
end
# @param status [TaskStatus]
def task_status_badge(status)
# TODO: extract into a component probably
content_tag(:span, status.name, class: ['badge', 'task-status', status.category.dasherize])
end
def task_status_selector(task, selector_class: '', id: nil, with_form: false)
# TODO: extract into a component probably
raise 'You should pass id if you want the form' if with_form && id.blank?
render partial: 'tasks/status_selector', locals: { task:, selector_class:, id:, with_form: }
def task_status_selector(task, with_form: false)
render Tasks::Statuses::SelectorViewModel.new(task, with_form:)
end
end