diff options
author | Paul Slaughter <pslaughter@gitlab.com> | 2019-08-07 14:58:53 +0000 |
---|---|---|
committer | Paul Slaughter <pslaughter@gitlab.com> | 2019-08-07 14:58:53 +0000 |
commit | 35e49d3be0ffe58fef80c30f6b432312541b8a73 (patch) | |
tree | 5e5b3617ee8e14c15286bbce8c1f1a2330c9a489 /app | |
parent | 2b7218cfe56dcbcb287bea7f7d4bd094a2822f00 (diff) | |
parent | f89a8fee9d98b9d28d09123496c971fcc5949fff (diff) | |
download | gitlab-ce-35e49d3be0ffe58fef80c30f6b432312541b8a73.tar.gz |
Merge branch '47814-search-view-labels' into 'master'
Resolve "Selected project in the search view is not fully readable"
Closes #47814
See merge request gitlab-org/gitlab-ce!31137
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/pages/search/show/search.js | 6 | ||||
-rw-r--r-- | app/assets/stylesheets/pages/search.scss | 45 | ||||
-rw-r--r-- | app/views/search/_filter.html.haml | 14 | ||||
-rw-r--r-- | app/views/search/_form.html.haml | 26 | ||||
-rw-r--r-- | app/views/search/show.html.haml | 6 |
5 files changed, 61 insertions, 36 deletions
diff --git a/app/assets/javascripts/pages/search/show/search.js b/app/assets/javascripts/pages/search/show/search.js index d5a8e712d6b..7743e05e748 100644 --- a/app/assets/javascripts/pages/search/show/search.js +++ b/app/assets/javascripts/pages/search/show/search.js @@ -37,9 +37,6 @@ export default class Search { text(obj) { return obj.full_name; }, - toggleLabel(obj) { - return `${$groupDropdown.data('defaultLabel')} ${obj.full_name}`; - }, clicked: () => Search.submitSearch(), }); @@ -70,9 +67,6 @@ export default class Search { text(obj) { return obj.name_with_namespace; }, - toggleLabel(obj) { - return `${$projectDropdown.data('defaultLabel')} ${obj.name_with_namespace}`; - }, clicked: () => Search.submitSearch(), }); } diff --git a/app/assets/stylesheets/pages/search.scss b/app/assets/stylesheets/pages/search.scss index dbf600df9d6..58e46cfb70f 100644 --- a/app/assets/stylesheets/pages/search.scss +++ b/app/assets/stylesheets/pages/search.scss @@ -186,15 +186,12 @@ input[type='checkbox']:hover { } } -.search-holder { - @include media-breakpoint-up(sm) { - display: flex; - } +.search-field-holder, +.project-filter-form { + flex: 1 0 auto; + position: relative; - .search-field-holder, - .project-filter-form { - flex: 1 0 auto; - position: relative; + .search-holder & { margin-right: 0; @include media-breakpoint-up(sm) { @@ -202,6 +199,7 @@ input[type='checkbox']:hover { } } + .search-icon { position: absolute; left: 10px; @@ -215,9 +213,16 @@ input[type='checkbox']:hover { padding-left: $gl-padding + 15px; padding-right: $gl-padding + 15px; } +} + +.search-holder { + @include media-breakpoint-up(sm) { + display: flex; + } .btn-search, - .btn-success { + .btn-success, + .dropdown-menu-toggle { width: 100%; margin-top: 5px; @@ -236,9 +241,6 @@ input[type='checkbox']:hover { } .dropdown-menu-toggle { - width: 100%; - margin-top: 5px; - @include media-breakpoint-up(sm) { width: 180px; margin-top: 0; @@ -262,6 +264,25 @@ input[type='checkbox']:hover { } } +.search-page-form { + .dropdown-menu-toggle, + .btn-search { + width: 100%; + } + + .dropdown-menu-toggle { + @include media-breakpoint-up(lg) { + width: 240px; + } + } + + .btn-search { + @include media-breakpoint-up(lg) { + width: auto; + } + } +} + // Disable webkit input icons, link to solution: https://stackoverflow.com/questions/9421551/how-do-i-remove-all-default-webkit-search-field-styling /* stylelint-disable property-no-vendor-prefix */ input[type='search']::-webkit-search-decoration, diff --git a/app/views/search/_filter.html.haml b/app/views/search/_filter.html.haml index c8b6a3258ab..bee4aff605f 100644 --- a/app/views/search/_filter.html.haml +++ b/app/views/search/_filter.html.haml @@ -2,10 +2,11 @@ = hidden_field_tag :group_id, params[:group_id] - if params[:project_id].present? = hidden_field_tag :project_id, params[:project_id] -.dropdown - %button.dropdown-menu-toggle.js-search-group-dropdown{ type: "button", data: { toggle: "dropdown", default_label: _('Group:'), group_id: params[:group_id] } } +.dropdown.form-group.mb-lg-0.mx-lg-1 + %label.d-block{ for: "dashboard_search_group" } + = _("Group") + %button.dropdown-menu-toggle.js-search-group-dropdown.mt-0{ type: "button", id: "dashboard_search_group", data: { toggle: "dropdown", group_id: params[:group_id] } } %span.dropdown-toggle-text - = _("Group:") - if @group.present? = @group.name - else @@ -17,10 +18,11 @@ = dropdown_content = dropdown_loading -.dropdown.project-filter - %button.dropdown-menu-toggle.js-search-project-dropdown{ type: "button", data: { toggle: "dropdown", default_label: _('Project:') } } +.dropdown.project-filter.form-group.mb-lg-0.mx-lg-1 + %label.d-block{ for: "dashboard_search_project" } + = _("Project") + %button.dropdown-menu-toggle.js-search-project-dropdown.mt-0{ type: "button", id: "dashboard_search_project", data: { toggle: "dropdown"} } %span.dropdown-toggle-text - = _("Project:") - if @project.present? = @project.full_name - else diff --git a/app/views/search/_form.html.haml b/app/views/search/_form.html.haml index db0dcc8adfb..4c4f3e0298b 100644 --- a/app/views/search/_form.html.haml +++ b/app/views/search/_form.html.haml @@ -1,16 +1,20 @@ -= form_tag search_path, method: :get, class: 'js-search-form' do |f| += form_tag search_path, method: :get, class: 'search-page-form js-search-form' do |f| = hidden_field_tag :snippets, params[:snippets] = hidden_field_tag :scope, params[:scope] - .search-holder - .search-field-holder - = search_field_tag :search, params[:search], placeholder: _("Search for projects, issues, etc."), class: "form-control search-text-input js-search-input", id: "dashboard_search", autofocus: true, spellcheck: false - = icon("search", class: "search-icon") - %button.search-clear.js-search-clear{ class: ("hidden" if !params[:search].present?), type: "button", tabindex: "-1" } - = icon("times-circle") - %span.sr-only - = _("Clear search") + .d-lg-flex.align-items-end + .search-field-holder.form-group.mr-lg-1.mb-lg-0 + %label{ for: "dashboard_search" } + = _("What are you searching for?") + .position-relative + = search_field_tag :search, params[:search], placeholder: _("Search for projects, issues, etc."), class: "form-control search-text-input js-search-input", id: "dashboard_search", autofocus: true, spellcheck: false + = icon("search", class: "search-icon") + %button.search-clear.js-search-clear{ class: ("hidden" if !params[:search].present?), type: "button", tabindex: "-1" } + = icon("times-circle") + %span.sr-only + = _("Clear search") - unless params[:snippets].eql? 'true' = render 'filter' - = button_tag _("Search"), class: "btn btn-success btn-search" - = render_if_exists 'search/form_elasticsearch' + .d-flex-center.flex-column.flex-lg-row + = button_tag _("Search"), class: "btn btn-success btn-search form-control mt-lg-0 ml-lg-1 align-self-end" + = render_if_exists 'search/form_elasticsearch' diff --git a/app/views/search/show.html.haml b/app/views/search/show.html.haml index 3260d05f509..9235678bc1d 100644 --- a/app/views/search/show.html.haml +++ b/app/views/search/show.html.haml @@ -1,6 +1,10 @@ - @hide_top_links = true -- breadcrumb_title _("Search") - page_title @search_term +- @hide_breadcrumbs = true + +.page-title-holder.d-flex.align-items-center + %h1.page-title< + = _('Search') .prepend-top-default = render 'search/form' |