2014-09-02 18:07:02 +05:30
|
|
|
.search
|
|
|
|
= form_tag search_path, method: :get, class: 'navbar-form pull-left' do |f|
|
2015-10-24 18:46:33 +05:30
|
|
|
= search_field_tag "search", nil, placeholder: search_placeholder, class: "search-input form-control", spellcheck: false
|
2014-09-02 18:07:02 +05:30
|
|
|
= hidden_field_tag :group_id, @group.try(:id)
|
|
|
|
- if @project && @project.persisted?
|
|
|
|
= hidden_field_tag :project_id, @project.id
|
2015-04-26 12:48:37 +05:30
|
|
|
|
|
|
|
- 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'
|
2015-11-26 14:37:03 +05:30
|
|
|
- elsif current_controller?(:commits)
|
|
|
|
= hidden_field_tag :scope, 'commits'
|
2015-04-26 12:48:37 +05:30
|
|
|
- else
|
|
|
|
= hidden_field_tag :search_code, true
|
|
|
|
|
|
|
|
- if @snippet || @snippets
|
|
|
|
= hidden_field_tag :snippets, true
|
2014-09-02 18:07:02 +05:30
|
|
|
= hidden_field_tag :repository_ref, @ref
|
2015-04-26 12:48:37 +05:30
|
|
|
= button_tag 'Go' if ENV['RAILS_ENV'] == 'test'
|
2014-09-02 18:07:02 +05:30
|
|
|
.search-autocomplete-opts.hide{:'data-autocomplete-path' => search_autocomplete_path, :'data-autocomplete-project-id' => @project.try(:id), :'data-autocomplete-project-ref' => @ref }
|
2015-04-26 12:48:37 +05:30
|
|
|
|
|
|
|
:javascript
|
|
|
|
$('.search-input').on('keyup', function(e) {
|
|
|
|
if (e.keyCode == 27) {
|
2015-11-26 14:37:03 +05:30
|
|
|
$('.search-input').blur();
|
2015-04-26 12:48:37 +05:30
|
|
|
}
|
2015-11-26 14:37:03 +05:30
|
|
|
});
|