summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2016-10-03 15:07:29 +0100
committerPhil Hughes <me@iamphill.com>2016-10-03 15:07:35 +0100
commitf917bf80e81b433f5bbf06ea90bc3d3d0b880bc7 (patch)
treec7bb8223a5af8b4a486cc36697a6fe63e6f8d031
parent06fdfc7395681ee6dca6f1b9d998cdbeb57b0a24 (diff)
downloadgitlab-ce-todo-issue-due-date.tar.gz
Removed try method call on due datetodo-issue-due-date
-rw-r--r--app/helpers/todos_helper.rb14
1 files changed, 11 insertions, 3 deletions
diff --git a/app/helpers/todos_helper.rb b/app/helpers/todos_helper.rb
index 3d2e079c380..a9db8bb2b82 100644
--- a/app/helpers/todos_helper.rb
+++ b/app/helpers/todos_helper.rb
@@ -117,11 +117,19 @@ module TodosHelper
def todo_due_date(todo)
return unless todo.target.try(:due_date)
- is_due_today = todo.target.due_date.try(:today?)
- is_overdue = todo.target.try(:overdue?)
+ is_due_today = todo.target.due_date.today?
+ is_overdue = todo.target.overdue?
+ css_class =
+ if is_due_today
+ 'text-warning'
+ elsif is_overdue
+ 'text-danger'
+ else
+ ''
+ end
html = "&middot; ".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)}"
end
end