summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2016-09-23 17:28:06 +0100
committerPhil Hughes <me@iamphill.com>2016-10-03 09:55:12 +0100
commita3abfb9708d894b434484fa0e2a836bb0ebd2cdb (patch)
tree25b429aa36ed336385829f1cdcf1b939ea9cce17
parent08b7480f51f6072ba70b8739301b1ba5d1df1213 (diff)
downloadgitlab-ce-a3abfb9708d894b434484fa0e2a836bb0ebd2cdb.tar.gz
Moved todo due date text into helper method
-rw-r--r--app/helpers/todos_helper.rb6
-rw-r--r--app/views/dashboard/todos/_todo.html.haml6
2 files changed, 7 insertions, 5 deletions
diff --git a/app/helpers/todos_helper.rb b/app/helpers/todos_helper.rb
index 1e86f648203..26d61c32744 100644
--- a/app/helpers/todos_helper.rb
+++ b/app/helpers/todos_helper.rb
@@ -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)
diff --git a/app/views/dashboard/todos/_todo.html.haml b/app/views/dashboard/todos/_todo.html.haml
index 06ea5675a0f..45d50f323e1 100644
--- a/app/views/dashboard/todos/_todo.html.haml
+++ b/app/views/dashboard/todos/_todo.html.haml
@@ -25,11 +25,7 @@
- is_overdue = todo.target.try(:overdue?)
&middot;
%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