BigW Consortium Gitlab

_search.html.haml 1.93 KB
Newer Older
1
- if controller.controller_path =~ /^groups/ && @group.persisted?
2
  - label = 'This group'
3
- if controller.controller_path =~ /^projects/ && @project.persisted?
4 5 6
  - label = 'This project'

.search.search-form{class: "#{'has-location-badge' if label.present?}"}
7 8
  = form_tag search_path, method: :get, class: 'navbar-form' do |f|
    .search-input-container
9 10
      - if label.present?
        .location-badge= label
11
      .search-input-wrap
12 13 14
        .dropdown{ data: {url: search_autocomplete_path } }
          = search_field_tag "search", nil, placeholder: 'Search', class: "search-input dropdown-menu-toggle", spellcheck: false, tabindex: "1", autocomplete: 'off',  data: { toggle: 'dropdown' }
          .dropdown-menu.dropdown-select
15
            = dropdown_content do
16 17 18 19
              %ul
                %li
                  %a.is-focused.dropdown-menu-empty-link
                    Loading...
20
            = dropdown_loading
21 22
          %i.search-icon
          %i.clear-icon.js-clear-input
23

24
    = hidden_field_tag :group_id, @group.try(:id)
25
    = hidden_field_tag :project_id, @project && @project.persisted? ? @project.id : '', id: 'search_project_id'
26 27

    - if @project && @project.persisted?
28 29 30 31 32 33
      - if current_controller?(:issues)
        = hidden_field_tag :scope, 'issues'
      - elsif current_controller?(:merge_requests)
        = hidden_field_tag :scope, 'merge_requests'
      - elsif current_controller?(:wikis)
        = hidden_field_tag :scope, 'wiki_blobs'
34 35
      - elsif current_controller?(:commits)
        = hidden_field_tag :scope, 'commits'
36 37 38
      - else
        = hidden_field_tag :search_code, true

39 40
    - if @snippet || @snippets
      = hidden_field_tag :snippets, true
41
    = hidden_field_tag :repository_ref, @ref
42
    = button_tag 'Go' if ENV['RAILS_ENV'] == 'test'
43
    .search-autocomplete-opts.hide{:'data-autocomplete-path' => search_autocomplete_path, :'data-autocomplete-project-id' => @project.try(:id), :'data-autocomplete-project-ref' => @ref }