summaryrefslogtreecommitdiff
path: root/app/views/layouts/_search.html.haml
blob: 0c6932e59a9334b2fe87d25a89cabd2a33633379 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
.search.search-form{ data: { track_label: "navbar_search", track_event: "activate_form_input", track_value: "" } }
  = form_tag search_path, method: :get, class: 'form-inline' do |_f|
    .search-input-container
      .search-input-wrap
        .dropdown{ data: { url: search_autocomplete_path } }
          = search_field_tag 'search', nil, placeholder: _('Search or jump to…'),
                                            class: 'search-input dropdown-menu-toggle no-outline js-search-dashboard-options',
                                            spellcheck: false,
                                            tabindex: '1',
                                            autocomplete: 'off',
                                            data: { issues_path: issues_dashboard_path,
                                              mr_path: merge_requests_dashboard_path,
                                              qa_selector: 'search_term_field' },
                                            aria: { label: _('Search or jump to…') }
          %button.hidden.js-dropdown-search-toggle{ type: 'button', data: { toggle: 'dropdown' } }
          .dropdown-menu.dropdown-select.js-dashboard-search-options
            = dropdown_content do
              %ul
                %li.dropdown-menu-empty-item
                  %a
                    = _('Loading...')
            = dropdown_loading
          = sprite_icon('search', css_class: 'search-icon')
          = sprite_icon('close', css_class: 'clear-icon js-clear-input')

    = 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

    - if search_context.for_project?
      = hidden_field_tag :scope, search_context.scope
      = hidden_field_tag :search_code, search_context.code_search?

    = hidden_field_tag :snippets, search_context.for_snippets?
    = hidden_field_tag :repository_ref, search_context.ref
    = hidden_field_tag :nav_source, 'navbar'

    -# workaround for non-JS feature specs, see spec/support/helpers/search_helpers.rb
    - if ENV['RAILS_ENV'] == 'test'
      %noscript= button_tag 'Search'
    .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 }