summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeinrich Lee Yu <hleeyu@gmail.com>2018-11-02 22:51:18 +0800
committerHeinrich Lee Yu <hleeyu@gmail.com>2018-11-19 23:58:35 +0800
commit3924c20bb23262370580c4563cb675207faf16d3 (patch)
treed7838397433bb3bdced80b7e22662020d522e101
parent08ddb655ef461c57355eeb83edf10988decb2ced (diff)
downloadgitlab-ce-3924c20bb23262370580c4563cb675207faf16d3.tar.gz
Show separate empty_state if issues are filtered
-rw-r--r--app/helpers/application_helper.rb15
-rw-r--r--app/views/shared/empty_states/_issues.html.haml7
-rw-r--r--locale/gitlab.pot6
-rw-r--r--spec/features/issues_spec.rb18
4 files changed, 45 insertions, 1 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 74042f0bae8..183db931f90 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -188,6 +188,21 @@ module ApplicationHelper
"#{request.path}?#{params.to_param}"
end
+ def filter_bar_params
+ {
+ milestone_title: params[:milestone_title],
+ assignee_id: params[:assignee_id],
+ author_id: params[:author_id],
+ search: params[:search],
+ label_name: params[:label_name],
+ my_reaction_emoji: params[:my_reaction_emoji]
+ }
+ end
+
+ def has_filter_bar_param?
+ filter_bar_params.values.any? { |v| v.present? }
+ end
+
def outdated_browser?
browser.ie? && browser.version.to_i < 10
end
diff --git a/app/views/shared/empty_states/_issues.html.haml b/app/views/shared/empty_states/_issues.html.haml
index 2e26fe63d3e..00b2741d392 100644
--- a/app/views/shared/empty_states/_issues.html.haml
+++ b/app/views/shared/empty_states/_issues.html.haml
@@ -8,7 +8,12 @@
= image_tag 'illustrations/issues.svg'
.col-12
.text-content
- - if current_user
+ - if has_filter_bar_param?
+ %h4.text-center
+ = _("Sorry, your filter produced no results")
+ %p.text-center
+ = _("To widen your search, change or remove filters in the filter bar above")
+ - elsif current_user
%h4
= _("The Issue Tracker is the place to add things that need to be improved or solved in a project")
%p
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index f18821adb5f..d643d897efb 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -5736,6 +5736,9 @@ msgstr ""
msgid "Something went wrong. Please try again."
msgstr ""
+msgid "Sorry, your filter produced no results"
+msgstr ""
+
msgid "Sort by"
msgstr ""
@@ -6609,6 +6612,9 @@ msgstr ""
msgid "To validate your GitLab CI configurations, go to 'CI/CD → Pipelines' inside your project, and click on the 'CI Lint' button."
msgstr ""
+msgid "To widen your search, change or remove filters in the filter bar above"
+msgstr ""
+
msgid "Today"
msgstr ""
diff --git a/spec/features/issues_spec.rb b/spec/features/issues_spec.rb
index 4d9b8a10e04..adc0ee15c59 100644
--- a/spec/features/issues_spec.rb
+++ b/spec/features/issues_spec.rb
@@ -17,6 +17,15 @@ describe 'Issues' do
expect(page).to have_content('The Issue Tracker is the place to add things that need to be improved or solved in a project.')
expect(page).to have_content('You can register or sign in to create issues for this project.')
end
+
+ it 'user sees empty state with filters' do
+ create(:issue, author: user, project: project)
+
+ visit project_issues_path(project, milestone_title: "1.0")
+
+ expect(page).to have_content('Sorry, your filter produced no results')
+ expect(page).to have_content('To widen your search, change or remove filters in the filter bar above')
+ end
end
end
@@ -37,6 +46,15 @@ describe 'Issues' do
expect(page).to have_content('Issues can be bugs, tasks or ideas to be discussed. Also, issues are searchable and filterable.')
expect(page).to have_content('New issue')
end
+
+ it 'user sees empty state with filters' do
+ create(:issue, author: user, project: project)
+
+ visit project_issues_path(project, milestone_title: "1.0")
+
+ expect(page).to have_content('Sorry, your filter produced no results')
+ expect(page).to have_content('To widen your search, change or remove filters in the filter bar above')
+ end
end
describe 'Edit issue' do