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 ...@@ -114,6 +114,12 @@ module TodosHelper
selected_type ? selected_type[:text] : default_type selected_type ? selected_type[:text] : default_type
end 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 private
def show_todo_state?(todo) def show_todo_state?(todo)
......
...@@ -25,11 +25,7 @@ ...@@ -25,11 +25,7 @@
- is_overdue = todo.target.try(:overdue?) - is_overdue = todo.target.try(:overdue?)
· ·
%span{ class: [('text-warning' if is_due_today), ('text-danger' if is_overdue)] } %span{ class: [('text-warning' if is_due_today), ('text-danger' if is_overdue)] }
Due = todo_due_date(todo)
- if is_due_today
today
- else
= todo.target.due_date.to_s(:medium)
.todo-body .todo-body
.todo-note .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