diff options
Diffstat (limited to 'app/views/search')
-rw-r--r-- | app/views/search/_category.html.haml | 2 | ||||
-rw-r--r-- | app/views/search/_results.html.haml | 8 | ||||
-rw-r--r-- | app/views/search/_results_list.html.haml | 2 | ||||
-rw-r--r-- | app/views/search/_results_status.html.haml | 8 | ||||
-rw-r--r-- | app/views/search/_results_status_horiz_nav.html.haml | 20 | ||||
-rw-r--r-- | app/views/search/_results_status_vert_nav.html.haml | 20 | ||||
-rw-r--r-- | app/views/search/show.html.haml | 4 |
7 files changed, 31 insertions, 33 deletions
diff --git a/app/views/search/_category.html.haml b/app/views/search/_category.html.haml index 3e483fe8cd2..74a5d5fb425 100644 --- a/app/views/search/_category.html.haml +++ b/app/views/search/_category.html.haml @@ -23,7 +23,7 @@ = search_filter_link 'milestones', _("Milestones") = users - - elsif @search_service.show_snippets? + - elsif @search_service_presenter.show_snippets? = search_filter_link 'snippet_titles', _("Titles and Descriptions"), search: { snippets: true, group_id: nil, project_id: nil } - else = search_filter_link 'projects', _("Projects"), data: { qa_selector: 'projects_tab' } diff --git a/app/views/search/_results.html.haml b/app/views/search/_results.html.haml index 027ae6bf77c..5c952042663 100644 --- a/app/views/search/_results.html.haml +++ b/app/views/search/_results.html.haml @@ -3,16 +3,16 @@ = render_if_exists 'shared/promotions/promote_advanced_search' - if Feature.enabled?(:search_page_vertical_nav, current_user) .results.gl-md-display-flex.gl-mt-0 - #js-search-sidebar{ class: search_bar_classes, data: { navigation: search_navigation_json } } + #js-search-sidebar{ class: search_bar_classes, data: { navigation_json: search_navigation_json } } .gl-w-full.gl-flex-grow-1.gl-overflow-x-hidden - = render partial: 'search/results_status', locals: { search_service: @search_service } unless @search_objects.to_a.empty? + = render partial: 'search/results_status' unless @search_objects.to_a.empty? = render partial: 'search/results_list' - else - = render partial: 'search/results_status', locals: { search_service: @search_service } unless @search_objects.to_a.empty? + = render partial: 'search/results_status' unless @search_objects.to_a.empty? .results.gl-md-display-flex.gl-mt-3 - if %w[issues merge_requests].include?(@scope) - #js-search-sidebar{ class: search_bar_classes, data: { navigation: search_navigation_json } } + #js-search-sidebar{ class: search_bar_classes, data: { navigation_json: search_navigation_json } } .gl-w-full.gl-flex-grow-1.gl-overflow-x-hidden = render partial: 'search/results_list' diff --git a/app/views/search/_results_list.html.haml b/app/views/search/_results_list.html.haml index cf910402ad4..195f0f3ad8a 100644 --- a/app/views/search/_results_list.html.haml +++ b/app/views/search/_results_list.html.haml @@ -7,7 +7,7 @@ %ul.content-list.commit-list = render partial: "search/results/commit", collection: @search_objects - else - .search-results + .search-results.js-search-results - if @scope == 'projects' .term = render 'shared/projects/list', projects: @search_objects, pipeline_status: false diff --git a/app/views/search/_results_status.html.haml b/app/views/search/_results_status.html.haml index adea6b598f7..3cd100db8b7 100644 --- a/app/views/search/_results_status.html.haml +++ b/app/views/search/_results_status.html.haml @@ -1,8 +1,6 @@ -- search_service = local_assigns.fetch(:search_service) - -- return unless search_service.show_results_status? +- return unless @search_service_presenter.show_results_status? - if Feature.enabled?(:search_page_vertical_nav, current_user) - = render partial: 'search/results_status_vert_nav', locals: { search_service: search_service } + = render partial: 'search/results_status_vert_nav' - else - = render partial: 'search/results_status_horiz_nav', locals: { search_service: search_service } + = render partial: 'search/results_status_horiz_nav' diff --git a/app/views/search/_results_status_horiz_nav.html.haml b/app/views/search/_results_status_horiz_nav.html.haml index fe6ee0f12ec..c0778b70c04 100644 --- a/app/views/search/_results_status_horiz_nav.html.haml +++ b/app/views/search/_results_status_horiz_nav.html.haml @@ -1,22 +1,22 @@ .search-results-status .row-content-block.gl-display-flex .gl-md-display-flex.gl-text-left.gl-align-items-center.gl-flex-grow-1 - - unless search_service.without_count? - = search_entries_info(search_service.search_objects, search_service.scope, params[:search]) - - unless search_service.show_snippets? - - if search_service.project - - link_to_project = link_to(search_service.project.full_name, search_service.project, class: 'ml-md-1') - - if search_service.scope == 'blobs' + - unless @search_service_presenter.without_count? + = search_entries_info(@search_objects, @scope, @search_term) + - unless @search_service_presenter.show_snippets? + - if @project + - link_to_project = link_to(@project.full_name, @project, class: 'ml-md-1') + - if @scope == 'blobs' = _("in") .mx-md-1 - #js-blob-ref-switcher{ data: { "project-id" => search_service.project.id, "ref" => repository_ref(search_service.project), "field-name": "repository_ref" } } + #js-blob-ref-switcher{ data: { "project-id" => @project.id, "ref" => repository_ref(@project), "field-name": "repository_ref" } } = s_('SearchCodeResults|of %{link_to_project}').html_safe % { link_to_project: link_to_project } - else = _("in project %{link_to_project}").html_safe % { link_to_project: link_to_project } - - elsif search_service.group - - link_to_group = link_to(search_service.group.name, search_service.group, class: 'ml-md-1') + - elsif @group + - link_to_group = link_to(@group.name, @group, class: 'ml-md-1') = _("in group %{link_to_group}").html_safe % { link_to_group: link_to_group } - - if search_service.show_sort_dropdown? + - if @search_service_presenter.show_sort_dropdown? .gl-md-display-flex.gl-flex-direction-column #js-search-sort{ data: { "search-sort-options" => search_sort_options.to_json } } diff --git a/app/views/search/_results_status_vert_nav.html.haml b/app/views/search/_results_status_vert_nav.html.haml index 03916911f43..29cc0a20123 100644 --- a/app/views/search/_results_status_vert_nav.html.haml +++ b/app/views/search/_results_status_vert_nav.html.haml @@ -2,22 +2,22 @@ .gl-display-flex.gl-flex-direction-column .gl-p-5.gl-display-flex .gl-md-display-flex.gl-text-left.gl-align-items-center.gl-flex-grow-1 - - unless search_service.without_count? - = search_entries_info(search_service.search_objects, search_service.scope, params[:search]) - - unless search_service.show_snippets? - - if search_service.project - - link_to_project = link_to(search_service.project.full_name, search_service.project, class: 'ml-md-1') - - if search_service.scope == 'blobs' + - unless @search_service_presenter.without_count? + = search_entries_info(@search_objects, @scope, @search_term) + - unless @search_service_presenter.show_snippets? + - if @project + - link_to_project = link_to(@project.full_name, @project, class: 'ml-md-1') + - if @scope == 'blobs' = _("in") .mx-md-1 - #js-blob-ref-switcher{ data: { "project-id" => search_service.project.id, "ref" => repository_ref(search_service.project), "field-name": "repository_ref" } } + #js-blob-ref-switcher{ data: { "project-id" => @project.id, "ref" => repository_ref(@project), "field-name": "repository_ref" } } = s_('SearchCodeResults|of %{link_to_project}').html_safe % { link_to_project: link_to_project } - else = _("in project %{link_to_project}").html_safe % { link_to_project: link_to_project } - - elsif search_service.group - - link_to_group = link_to(search_service.group.name, search_service.group, class: 'ml-md-1') + - elsif @group + - link_to_group = link_to(@group.name, @group, class: 'ml-md-1') = _("in group %{link_to_group}").html_safe % { link_to_group: link_to_group } - - if search_service.show_sort_dropdown? + - if @search_service_presenter.show_sort_dropdown? .gl-md-display-flex.gl-flex-direction-column #js-search-sort{ data: { "search-sort-options" => search_sort_options.to_json } } %hr.gl-mb-5.gl-mt-0.gl-border-gray-100.gl-w-full diff --git a/app/views/search/show.html.haml b/app/views/search/show.html.haml index e1efa271d57..2eb6af94008 100644 --- a/app/views/search/show.html.haml +++ b/app/views/search/show.html.haml @@ -9,7 +9,7 @@ - project_attributes = @project&.attributes&.slice('id', 'namespace_id', 'name')&.merge(name_with_namespace: @project&.name_with_namespace) - if @search_results - - if @search_service.without_count? + - if @search_service_presenter.without_count? - page_description(_("%{scope} results for term '%{term}'") % { scope: @scope, term: @search_term }) - else - page_description(_("%{count} %{scope} for term '%{term}'") % { count: @search_results.formatted_count(@scope), scope: @scope, term: @search_term }) @@ -20,7 +20,7 @@ = render_if_exists 'search/form_elasticsearch', attrs: { class: 'mb-2 mb-sm-0 align-self-center' } .gl-mt-3 - #js-search-topbar{ data: { "group-initial-json": group_attributes.to_json, "project-initial-json": project_attributes.to_json, "elasticsearch-enabled": @elasticsearch_in_use.to_s, "default-branch-name": @project&.default_branch } } + #js-search-topbar{ data: { "group-initial-json": group_attributes.to_json, "project-initial-json": project_attributes.to_json, "elasticsearch-enabled": @search_service_presenter.advanced_search_enabled?.to_s, "default-branch-name": @project&.default_branch } } - if @search_term - if Feature.disabled?(:search_page_vertical_nav, current_user) = render 'search/category' |