From 0bc9008ef62277094534711238894b4e43aca7b0 Mon Sep 17 00:00:00 2001
From: Phil Hughes <me@iamphill.com>
Date: Mon, 7 Nov 2016 16:12:05 +0000
Subject: [PATCH] Fixed todos empty state when filtering

Closes #24127
---
 app/helpers/todos_helper.rb               |  4 ++++
 app/views/dashboard/todos/index.html.haml | 20 ++++++++++++--------
 2 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/app/helpers/todos_helper.rb b/app/helpers/todos_helper.rb
index a9db8bb2b82..a75a03b16d2 100644
--- a/app/helpers/todos_helper.rb
+++ b/app/helpers/todos_helper.rb
@@ -61,6 +61,10 @@ module TodosHelper
     }
   end
 
+  def todos_filter_empty?
+    todos_filter_params.all? {|key, value| value.nil?}
+  end
+
   def todos_filter_path(options = {})
     without = options.delete(:without)
 
diff --git a/app/views/dashboard/todos/index.html.haml b/app/views/dashboard/todos/index.html.haml
index e247eebc3fc..16bdf284f83 100644
--- a/app/views/dashboard/todos/index.html.haml
+++ b/app/views/dashboard/todos/index.html.haml
@@ -83,14 +83,18 @@
     .todos-all-done
       = render "shared/empty_states/todos_all_done.svg"
       %h4.text-center
-        Good job! Looks like you don't have any todos left.
-      %p.text-center
-        Are you looking for things to do? Take a look at
-        = succeed "," do
-          = link_to "the opened issues", issues_dashboard_path
-        contribute to
-        = link_to "merge requests", merge_requests_dashboard_path
-        or mention someone in a comment to assign a new todo automatically.
+        - if todos_filter_empty?
+          Good job! Looks like you don't have any todos left.
+        - else
+          There are no Todos to show.
+      - if todos_filter_empty?
+        %p.text-center
+          Are you looking for things to do? Take a look at
+          = succeed "," do
+            = link_to "the opened issues", issues_dashboard_path
+          contribute to
+          = link_to "merge requests", merge_requests_dashboard_path
+          or mention someone in a comment to assign a new todo automatically.
   - else
     .todos-empty
       .todos-empty-hero
-- 
GitLab