BigW Consortium Gitlab

_search.html.haml 1.13 KB
Newer Older
1
.search
2
  = form_tag search_path, method: :get, class: 'navbar-form pull-left' do |f|
3
    = search_field_tag "search", nil, placeholder: search_placeholder, class: "search-input form-control"
4
    = hidden_field_tag :group_id, @group.try(:id)
5 6
    - if @project && @project.persisted?
      = hidden_field_tag :project_id, @project.id
7 8 9 10 11 12 13 14 15 16

      - 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'
      - else
        = hidden_field_tag :search_code, true

17 18
    - if @snippet || @snippets
      = hidden_field_tag :snippets, true
19
    = hidden_field_tag :repository_ref, @ref
20
    = button_tag 'Go' if ENV['RAILS_ENV'] == 'test'
21
    .search-autocomplete-opts.hide{:'data-autocomplete-path' => search_autocomplete_path, :'data-autocomplete-project-id' => @project.try(:id), :'data-autocomplete-project-ref' => @ref }
22 23 24 25 26 27 28

:javascript
  $('.search-input').on('keyup', function(e) {
    if (e.keyCode == 27) {
      $('.search-input').blur()
    }
  })