_search.html.haml 2.59 KB
Newer Older
1
.search.search-form{ data: { track_label: "navbar_search", track_event: "activate_form_input", track_value: "" } }
2
  = form_tag search_path, method: :get, class: 'form-inline form-control' do |_f|
3 4
    .search-input-container
      .search-input-wrap
5
        .dropdown{ data: { url: search_autocomplete_path } }
6
          = search_field_tag 'search', nil, placeholder: _('Search GitLab'),
7 8 9 10
                                            class: 'search-input dropdown-menu-toggle no-outline js-search-dashboard-options',
                                            spellcheck: false,
                                            autocomplete: 'off',
                                            data: { issues_path: issues_dashboard_path,
11 12
                                              mr_path: merge_requests_dashboard_path,
                                              qa_selector: 'search_term_field' },
13
                                            aria: { label: _('Search GitLab') }
Filipa Lacerda's avatar
Filipa Lacerda committed
14
          %button.hidden.js-dropdown-search-toggle{ type: 'button', data: { toggle: 'dropdown' } }
15
          .dropdown-menu.dropdown-select{ data: { testid: 'dashboard-search-options' } }
16
            = dropdown_content do
17
              %ul
18 19
                %li.dropdown-menu-empty-item
                  %a
20
                    = _('Loading...')
21
            = dropdown_loading
22 23
          = sprite_icon('search', css_class: 'search-icon')
          = sprite_icon('close', css_class: 'clear-icon js-clear-input')
24

25 26
    = hidden_field_tag :group_id, search_context.for_group? ? search_context.group.id : '', class: 'js-search-group-options', data: search_context.group_metadata
    = hidden_field_tag :project_id, search_context.for_project? ? search_context.project.id : '', id: 'search_project_id', class: 'js-search-project-options', data: search_context.project_metadata
27

28
    - if search_context.for_project? || search_context.for_group?
29 30
      = hidden_field_tag :scope, search_context.scope
      = hidden_field_tag :search_code, search_context.code_search?
31

32 33
    = hidden_field_tag :snippets, search_context.for_snippets?
    = hidden_field_tag :repository_ref, search_context.ref
34
    = hidden_field_tag :nav_source, 'navbar'
35

36 37 38
    -# workaround for non-JS feature specs, see spec/support/helpers/search_helpers.rb
    - if ENV['RAILS_ENV'] == 'test'
      %noscript= button_tag 'Search'
39 40 41
    .search-autocomplete-opts.hide{ :'data-autocomplete-path' => search_autocomplete_path,
                                    :'data-autocomplete-project-id' => search_context.project.try(:id),
                                    :'data-autocomplete-project-ref' => search_context.ref }