Refactored task status into a view model
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user