diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-03 21:09:22 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-03 21:09:22 +0300 |
commit | 62baa95f25f1cc56b100d2b64b0a3906f47dcfe1 (patch) | |
tree | 0bee30bc13c3cb7444f1d89d2647719718a31d76 /app/helpers/search_helper.rb | |
parent | ff8eb438401fc82b883fc4ae69626f0035b69236 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/helpers/search_helper.rb')
-rw-r--r-- | app/helpers/search_helper.rb | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb index 3f182e3ebca..f951c8e22cf 100644 --- a/app/helpers/search_helper.rb +++ b/app/helpers/search_helper.rb @@ -92,11 +92,27 @@ module SearchHelper end end - def search_entries_empty_message(scope, term) - (s_("SearchResults|We couldn't find any %{scope} matching %{term}") % { + def search_entries_empty_message(scope, term, group, project) + options = { scope: search_entries_scope_label(scope, 0), - term: "<code>#{h(term)}</code>" - }).html_safe + term: "<code>#{h(term)}</code>".html_safe + } + + # We check project first because we have 3 possible combinations here: + # - group && project + # - group + # - group: nil, project: nil + if project + html_escape(_("We couldn't find any %{scope} matching %{term} in project %{project}")) % options.merge( + project: link_to(project.full_name, project_path(project), target: '_blank', rel: 'noopener noreferrer').html_safe + ) + elsif group + html_escape(_("We couldn't find any %{scope} matching %{term} in group %{group}")) % options.merge( + group: link_to(group.full_name, group_path(group), target: '_blank', rel: 'noopener noreferrer').html_safe + ) + else + html_escape(_("We couldn't find any %{scope} matching %{term}")) % options + end end def repository_ref(project) |