Commit d616b8c0 authored by Dylan Griffith's avatar Dylan Griffith

Refactor revert to basic search url to helper

parent 2e417808
......@@ -196,11 +196,21 @@ module SearchHelper
Sanitize.clean(str)
end
SEARCH_PERMITTED_PARAMS = [:search, :scope, :project_id, :group_id, :repository_ref, :snippets]
def revert_to_basic_search_filter_url
search_params = params
.permit(SEARCH_PERMITTED_PARAMS)
.merge(basic_search: true)
search_path(search_params)
end
def search_filter_link(scope, label, data: {}, search: {})
search_params = params
.merge(search)
.merge({ scope: scope })
.permit(:search, :scope, :project_id, :group_id, :repository_ref, :snippets)
.permit(SEARCH_PERMITTED_PARAMS)
if @scope == scope
li_class = 'active'
......
- if search_service.use_elasticsearch?
- query_string = URI.parse(request.url).query
- query_params = Rack::Utils.parse_query(query_string)
- url = url_for :only_path => false, :params => query_params.merge(basic_search: 'true')
- begin_link = '<a href="%{url}">'.html_safe % { url: url }
- begin_link = '<a href="%{url}">'.html_safe % { url: revert_to_basic_search_filter_url }
- end_link = '</a>'.html_safe
%p.text-center
= _('You can try again using %{begin_link}basic search%{end_link}').html_safe % { begin_link: begin_link, end_link: end_link }
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