Commit 0803a350 authored by Josep Llaneras's avatar Josep Llaneras

Issue #13823: random message when all Todos are Done

parent 0e1e4288
......@@ -55,6 +55,7 @@ entry.
- Remove 'Edit' button from wiki edit view !7143 (Hiroyuki Sato)
- Cleaned up global namespace JS !19661 (Jose Ivan Vargas)
- Refactor Jira service to use jira-ruby gem
- Show random messages when the To Do list is empty. !13823 (jllaneras)
- Improved todos empty state
- Add hover to trash icon in notes !7008 (blackst0ne)
- Hides project activity tabs when features are disabled
......
......@@ -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
......
......@@ -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
......@@ -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
......
......@@ -215,6 +215,7 @@ Settings.gitlab.default_projects_features['visibility_level'] = Settings.send(
Settings.gitlab['domain_whitelist'] ||= []
Settings.gitlab['import_sources'] ||= %w[github bitbucket gitlab google_code fogbugz git gitlab_project]
Settings.gitlab['trusted_proxies'] ||= []
Settings.gitlab['no_todos_messages'] ||= YAML.load_file(Rails.root.join('config', 'no_todos_messages.yml'))
#
# CI
......
# When the Todos list on the user's dashboard is empty, one of the messages below shows up randomly.
#
# If you come up with a fun one, please feel free to contribute it to GitLab!
# https://about.gitlab.com/contributing/
---
-
message: "Good job! Looks like you don't have any todos left."
-
message: "You're all done!"
-
message: "Coffee really tastes better without any todos left."
author: "Josep Llaneras"
-
message: "Isn't an empty To Do list beautiful?"
author: "Josep Llaneras"
......@@ -44,7 +44,7 @@ describe 'Dashboard Todos', feature: true do
end
it 'shows "All done" message' do
expect(page).to have_content("Good job! Looks like you don't have any todos left.")
expect(page).to have_selector('.todos-all-done', count: 1)
end
end
......@@ -64,7 +64,7 @@ describe 'Dashboard Todos', feature: true do
end
it 'shows "All done" message' do
expect(page).to have_content("Good job! Looks like you don't have any todos left.")
expect(page).to have_selector('.todos-all-done', count: 1)
end
end
end
......@@ -152,7 +152,7 @@ describe 'Dashboard Todos', feature: true do
within('.todos-pending-count') { expect(page).to have_content '0' }
expect(page).to have_content 'To do 0'
expect(page).to have_content 'Done 0'
expect(page).to have_content "Good job! Looks like you don't have any todos left."
expect(page).to have_selector('.todos-all-done', count: 1)
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment