Skip to content
Snippets Groups Projects
Commit f917bf80 authored by Phil Hughes's avatar Phil Hughes
Browse files

Removed try method call on due date

parent 06fdfc73
No related branches found
No related tags found
No related merge requests found
Loading
@@ -117,11 +117,19 @@ module TodosHelper
Loading
@@ -117,11 +117,19 @@ module TodosHelper
def todo_due_date(todo) def todo_due_date(todo)
return unless todo.target.try(:due_date) return unless todo.target.try(:due_date)
   
is_due_today = todo.target.due_date.try(:today?) is_due_today = todo.target.due_date.today?
is_overdue = todo.target.try(:overdue?) is_overdue = todo.target.overdue?
css_class =
if is_due_today
'text-warning'
elsif is_overdue
'text-danger'
else
''
end
   
html = "· ".html_safe html = "· ".html_safe
html << content_tag(:span, class: [('text-warning' if is_due_today), ('text-danger' if is_overdue)]) do html << content_tag(:span, class: css_class) do
"Due #{is_due_today ? "today" : todo.target.due_date.to_s(:medium)}" "Due #{is_due_today ? "today" : todo.target.due_date.to_s(:medium)}"
end end
end end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment