diff options
Diffstat (limited to 'app/views/search')
-rw-r--r-- | app/views/search/_results.html.haml | 37 | ||||
-rw-r--r-- | app/views/search/_results_list.html.haml | 18 | ||||
-rw-r--r-- | app/views/search/_results_status.html.haml | 26 | ||||
-rw-r--r-- | app/views/search/_results_status_horiz_nav.html.haml | 22 | ||||
-rw-r--r-- | app/views/search/_results_status_vert_nav.html.haml | 23 | ||||
-rw-r--r-- | app/views/search/results/_snippet_title.html.haml | 2 | ||||
-rw-r--r-- | app/views/search/results/_wiki_blob.html.haml | 2 | ||||
-rw-r--r-- | app/views/search/show.html.haml | 3 |
8 files changed, 87 insertions, 46 deletions
diff --git a/app/views/search/_results.html.haml b/app/views/search/_results.html.haml index 168f4ca10bc..8262c3c90e1 100644 --- a/app/views/search/_results.html.haml +++ b/app/views/search/_results.html.haml @@ -1,26 +1,19 @@ - search_bar_classes = 'search-sidebar gl-display-flex gl-flex-direction-column gl-mr-4' + = render_if_exists 'shared/promotions/promote_advanced_search' -= render partial: 'search/results_status', locals: { search_service: @search_service } unless @search_objects.to_a.empty? +- if Feature.enabled?(:search_page_vertical_nav, current_user) && %w[issues merge_requests].include?(@scope) + .results.gl-md-display-flex.gl-mt-0 + #js-search-sidebar{ class: search_bar_classes, data: { navigation: 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_list' + +- else + = render partial: 'search/results_status', locals: { search_service: @search_service } 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 } - .gl-w-full.gl-flex-grow-1.gl-overflow-x-hidden - - if @timeout - = render partial: "search/results/timeout" - - elsif @search_objects.to_a.empty? - = render partial: "search/results/empty" - - else - - if @scope == 'commits' - %ul.content-list.commit-list - = render partial: "search/results/commit", collection: @search_objects - - else - .search-results - - if @scope == 'projects' - .term - = render 'shared/projects/list', projects: @search_objects, pipeline_status: false - - else - = render_if_exists partial: "search/results/#{@scope.singularize}", collection: @search_objects + .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 } } - - if @scope != 'projects' - = paginate_collection(@search_objects) + .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 new file mode 100644 index 00000000000..cf910402ad4 --- /dev/null +++ b/app/views/search/_results_list.html.haml @@ -0,0 +1,18 @@ +- if @timeout + = render partial: "search/results/timeout" +- elsif @search_objects.to_a.empty? + = render partial: "search/results/empty" +- else + - if @scope == 'commits' + %ul.content-list.commit-list + = render partial: "search/results/commit", collection: @search_objects + - else + .search-results + - if @scope == 'projects' + .term + = render 'shared/projects/list', projects: @search_objects, pipeline_status: false + - else + = render_if_exists partial: "search/results/#{@scope.singularize}", collection: @search_objects + + - if @scope != 'projects' + = paginate_collection(@search_objects) diff --git a/app/views/search/_results_status.html.haml b/app/views/search/_results_status.html.haml index ef5e3e83103..e6bb0c18b90 100644 --- a/app/views/search/_results_status.html.haml +++ b/app/views/search/_results_status.html.haml @@ -2,24 +2,8 @@ - return unless search_service.show_results_status? -.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' - = _("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" } } - = 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') - = _("in group %{link_to_group}").html_safe % { link_to_group: link_to_group } - - if search_service.show_sort_dropdown? - .gl-md-display-flex.gl-flex-direction-column - #js-search-sort{ data: { "search-sort-options" => search_sort_options.to_json } } +- if Feature.enabled?(:search_page_vertical_nav, current_user) + = render partial: 'search/results_status_vert_nav', locals: { search_service: @search_service } + +- else + = render partial: 'search/results_status_horiz_nav', locals: { search_service: @search_service } diff --git a/app/views/search/_results_status_horiz_nav.html.haml b/app/views/search/_results_status_horiz_nav.html.haml new file mode 100644 index 00000000000..fe6ee0f12ec --- /dev/null +++ b/app/views/search/_results_status_horiz_nav.html.haml @@ -0,0 +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' + = _("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" } } + = 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') + = _("in group %{link_to_group}").html_safe % { link_to_group: link_to_group } + - if search_service.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 new file mode 100644 index 00000000000..03916911f43 --- /dev/null +++ b/app/views/search/_results_status_vert_nav.html.haml @@ -0,0 +1,23 @@ +.search-results-status + .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' + = _("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" } } + = 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') + = _("in group %{link_to_group}").html_safe % { link_to_group: link_to_group } + - if search_service.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/results/_snippet_title.html.haml b/app/views/search/results/_snippet_title.html.haml index a28d9effbdd..a811dabf399 100644 --- a/app/views/search/results/_snippet_title.html.haml +++ b/app/views/search/results/_snippet_title.html.haml @@ -15,6 +15,6 @@ %span by = link_to user_snippets_path(snippet_title.author) do - = image_tag avatar_icon_for_user(snippet_title.author), class: "avatar avatar-inline s16", alt: '' + = render Pajamas::AvatarComponent.new(snippet_title.author, size: 16, class: 'gl-mt-n1') = snippet_title.author_name %span.light= time_ago_with_tooltip(snippet_title.created_at) diff --git a/app/views/search/results/_wiki_blob.html.haml b/app/views/search/results/_wiki_blob.html.haml index b59275c35df..d6900c397a0 100644 --- a/app/views/search/results/_wiki_blob.html.haml +++ b/app/views/search/results/_wiki_blob.html.haml @@ -4,6 +4,6 @@ %div{ class: 'search-result-row gl-pb-3! gl-mt-5 gl-mb-0!' } %span.gl-display-flex.gl-align-items-center = link_to wiki_blob_link, data: { track_action: 'click_text', track_label: "wiki_title", track_property: 'search_result' }, class: 'gl-w-full' do - %span.term.str-truncated.gl-font-weight-bold= ::Gitlab::Git::Wiki::GollumSlug.canonicalize_filename(wiki_blob.path) + %span.term.str-truncated.gl-font-weight-bold= ::Wiki.canonicalize_filename(wiki_blob.path) .description.term.col-sm-10.gl-px-0 = simple_search_highlight_and_truncate(wiki_blob.data, @search_term) diff --git a/app/views/search/show.html.haml b/app/views/search/show.html.haml index 5a45e512579..9d812e77ad4 100644 --- a/app/views/search/show.html.haml +++ b/app/views/search/show.html.haml @@ -22,5 +22,6 @@ .gl-mt-3 #js-search-topbar{ data: { "group-initial-data": group_attributes.to_json, "project-initial-data": project_attributes.to_json } } - if @search_term - = render 'search/category' + - if Feature.disabled?(:search_page_vertical_nav, current_user) + = render 'search/category' = render 'search/results' |