diff options
author | Josep Llaneras <pepmanuel@gmail.com> | 2016-10-12 01:22:09 +0200 |
---|---|---|
committer | Josep Llaneras <pepmanuel@gmail.com> | 2016-11-11 20:59:54 +0100 |
commit | 0803a350b09d2c80a7ff1c2d1e17712989b7a0c2 (patch) | |
tree | 42a6fb389abb4417c1dbacae1caf0a1b16a92ef1 /app | |
parent | 0e1e42885a792145dafc6aa28165d069b1cb5c03 (diff) | |
download | gitlab-ce-0803a350b09d2c80a7ff1c2d1e17712989b7a0c2.tar.gz |
Issue #13823: random message when all Todos are Done
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/dashboard/todos_controller.rb | 4 | ||||
-rw-r--r-- | app/helpers/todos_helper.rb | 11 | ||||
-rw-r--r-- | app/views/dashboard/todos/index.html.haml | 2 |
3 files changed, 16 insertions, 1 deletions
diff --git a/app/controllers/dashboard/todos_controller.rb b/app/controllers/dashboard/todos_controller.rb index d425d0f9014..ca65f75daac 100644 --- a/app/controllers/dashboard/todos_controller.rb +++ b/app/controllers/dashboard/todos_controller.rb @@ -4,6 +4,10 @@ class Dashboard::TodosController < Dashboard::ApplicationController def index @sort = params[:sort] @todos = @todos.page(params[:page]) + + if @todos.empty? && current_user.todos.any? + @no_todos_message = Gitlab.config.gitlab.no_todos_messages.sample + end end def destroy diff --git a/app/helpers/todos_helper.rb b/app/helpers/todos_helper.rb index 09c69786791..b7ca48ffa08 100644 --- a/app/helpers/todos_helper.rb +++ b/app/helpers/todos_helper.rb @@ -138,9 +138,20 @@ module TodosHelper end end + def no_todos_message + message, author = @no_todos_message.values_at('message', 'author') + + if author + message += " -- " + author + end + + message + end + private def show_todo_state?(todo) (todo.target.is_a?(MergeRequest) || todo.target.is_a?(Issue)) && ['closed', 'merged'].include?(todo.target.state) end + end diff --git a/app/views/dashboard/todos/index.html.haml b/app/views/dashboard/todos/index.html.haml index 5b2465e25ee..773645707d3 100644 --- a/app/views/dashboard/todos/index.html.haml +++ b/app/views/dashboard/todos/index.html.haml @@ -84,7 +84,7 @@ = render "shared/empty_states/todos_all_done.svg" - if todos_filter_empty? %h4.text-center - Good job! Looks like you don't have any todos left. + = no_todos_message %p.text-center Are you looking for things to do? Take a look at = succeed "," do |