Commit a3abfb97 authored by Phil Hughes's avatar Phil Hughes

Moved todo due date text into helper method

parent 08b7480f
......@@ -114,6 +114,12 @@ module TodosHelper
selected_type ? selected_type[:text] : default_type
end
def todo_due_date(todo)
is_due_today = todo.target.due_date.try(:today?)
"Due #{is_due_today ? "today" : todo.target.due_date.to_s(:medium)}"
end
private
def show_todo_state?(todo)
......
......@@ -25,11 +25,7 @@
- is_overdue = todo.target.try(:overdue?)
·
%span{ class: [('text-warning' if is_due_today), ('text-danger' if is_overdue)] }
Due
- if is_due_today
today
- else
= todo.target.due_date.to_s(:medium)
= todo_due_date(todo)
.todo-body
.todo-note
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment