Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2016-10-03 11:58:55 +0300
committerPhil Hughes <me@iamphill.com>2016-10-03 11:58:55 +0300
commit8ea18c37611ccb86b286761cc373c01199d64878 (patch)
tree96939c1c29f6269b585e446a4803db0333c8a756 /app/helpers/todos_helper.rb
parenta3abfb9708d894b434484fa0e2a836bb0ebd2cdb (diff)
Moved todo due date to helper method
Diffstat (limited to 'app/helpers/todos_helper.rb')
-rw-r--r--app/helpers/todos_helper.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/helpers/todos_helper.rb b/app/helpers/todos_helper.rb
index 26d61c32744..9542d3d7941 100644
--- a/app/helpers/todos_helper.rb
+++ b/app/helpers/todos_helper.rb
@@ -115,9 +115,14 @@ module TodosHelper
end
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?)
- "Due #{is_due_today ? "today" : todo.target.due_date.to_s(:medium)}"
+ content_tag :span, class: [('text-warning' if is_due_today), ('text-danger' if is_overdue)] do
+ "Due #{is_due_today ? "today" : todo.target.due_date.to_s(:medium)}"
+ end
end
private