2012-10-11 17:41:49 -04:00
|
|
|
.search
|
2012-11-20 16:05:15 -05:00
|
|
|
= form_tag search_path, method: :get, class: 'navbar-form pull-left' do |f|
|
2015-10-09 12:08:37 -04:00
|
|
|
= search_field_tag "search", nil, placeholder: search_placeholder, class: "search-input form-control", spellcheck: false
|
2013-01-25 03:07:21 -05:00
|
|
|
= hidden_field_tag :group_id, @group.try(:id)
|
2013-05-14 13:11:48 -04:00
|
|
|
- if @project && @project.persisted?
|
|
|
|
= hidden_field_tag :project_id, @project.id
|
2014-12-02 15:38:45 -05:00
|
|
|
|
|
|
|
- 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-06-14 18:04:20 -04:00
|
|
|
- elsif current_controller?(:commits)
|
|
|
|
= hidden_field_tag :scope, 'commits'
|
2014-12-02 15:38:45 -05:00
|
|
|
- else
|
|
|
|
= hidden_field_tag :search_code, true
|
|
|
|
|
2014-08-29 15:22:45 -04:00
|
|
|
- if @snippet || @snippets
|
|
|
|
= hidden_field_tag :snippets, true
|
2013-05-09 04:27:14 -04:00
|
|
|
= hidden_field_tag :repository_ref, @ref
|
2014-09-26 10:57:36 -04:00
|
|
|
= button_tag 'Go' if ENV['RAILS_ENV'] == 'test'
|
2014-01-18 07:16:46 -05:00
|
|
|
.search-autocomplete-opts.hide{:'data-autocomplete-path' => search_autocomplete_path, :'data-autocomplete-project-id' => @project.try(:id), :'data-autocomplete-project-ref' => @ref }
|
2014-08-21 04:14:31 -04:00
|
|
|
|
|
|
|
:javascript
|
|
|
|
$('.search-input').on('keyup', function(e) {
|
|
|
|
if (e.keyCode == 27) {
|
2015-11-10 06:17:37 -05:00
|
|
|
$('.search-input').blur();
|
2014-08-21 04:14:31 -04:00
|
|
|
}
|
2015-11-10 06:17:37 -05:00
|
|
|
});
|