Commit 3924c20b authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Show separate empty_state if issues are filtered

parent 08ddb655
...@@ -188,6 +188,21 @@ module ApplicationHelper ...@@ -188,6 +188,21 @@ module ApplicationHelper
"#{request.path}?#{params.to_param}" "#{request.path}?#{params.to_param}"
end 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? def outdated_browser?
browser.ie? && browser.version.to_i < 10 browser.ie? && browser.version.to_i < 10
end end
......
...@@ -8,7 +8,12 @@ ...@@ -8,7 +8,12 @@
= image_tag 'illustrations/issues.svg' = image_tag 'illustrations/issues.svg'
.col-12 .col-12
.text-content .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 %h4
= _("The Issue Tracker is the place to add things that need to be improved or solved in a project") = _("The Issue Tracker is the place to add things that need to be improved or solved in a project")
%p %p
......
...@@ -5736,6 +5736,9 @@ msgstr "" ...@@ -5736,6 +5736,9 @@ msgstr ""
msgid "Something went wrong. Please try again." msgid "Something went wrong. Please try again."
msgstr "" msgstr ""
msgid "Sorry, your filter produced no results"
msgstr ""
msgid "Sort by" msgid "Sort by"
msgstr "" msgstr ""
...@@ -6609,6 +6612,9 @@ 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." msgid "To validate your GitLab CI configurations, go to 'CI/CD → Pipelines' inside your project, and click on the 'CI Lint' button."
msgstr "" msgstr ""
msgid "To widen your search, change or remove filters in the filter bar above"
msgstr ""
msgid "Today" msgid "Today"
msgstr "" msgstr ""
......
...@@ -17,6 +17,15 @@ describe 'Issues' do ...@@ -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('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.') expect(page).to have_content('You can register or sign in to create issues for this project.')
end 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
end end
...@@ -37,6 +46,15 @@ describe 'Issues' do ...@@ -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('Issues can be bugs, tasks or ideas to be discussed. Also, issues are searchable and filterable.')
expect(page).to have_content('New issue') expect(page).to have_content('New issue')
end 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
describe 'Edit issue' do describe 'Edit issue' do
......
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