diff options
author | Alfredo Sumaran <alfredo@gitlab.com> | 2016-03-08 02:56:43 -0500 |
---|---|---|
committer | Alfredo Sumaran <alfredo@gitlab.com> | 2016-03-08 02:56:43 -0500 |
commit | 13fee27f32482736a874740939d2e80e3bb7d0ee (patch) | |
tree | 98e93e85db7edf412b05ab138d0d3a4f5bd322c7 /app/views | |
parent | 903aa7c95e82949ca0a7b18e1f6d2f25fe1b04f4 (diff) | |
download | gitlab-ce-wip_issue_3400.tar.gz |
Working version of autocomplete with categorized resultswip_issue_3400
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/layouts/_search.html.haml | 13 | ||||
-rw-r--r-- | app/views/shared/_location_badge.html.haml | 13 |
2 files changed, 17 insertions, 9 deletions
diff --git a/app/views/layouts/_search.html.haml b/app/views/layouts/_search.html.haml index 54af2c3063c..c5002893831 100644 --- a/app/views/layouts/_search.html.haml +++ b/app/views/layouts/_search.html.haml @@ -1,10 +1,12 @@ .search = form_tag search_path, method: :get, class: 'navbar-form pull-left' do |f| + = render 'shared/location_badge' = search_field_tag "search", nil, placeholder: 'Search', class: "search-input form-control", spellcheck: false, tabindex: "1" = hidden_field_tag :group_id, @group.try(:id) - - if @project && @project.persisted? - = hidden_field_tag :project_id, @project.id + = hidden_field_tag :project_id, @project && @project.persisted? ? @project.id : '' + + - if @project && @project.persisted? - if current_controller?(:issues) = hidden_field_tag :scope, 'issues' - elsif current_controller?(:merge_requests) @@ -21,10 +23,3 @@ = hidden_field_tag :repository_ref, @ref = button_tag 'Go' if ENV['RAILS_ENV'] == 'test' .search-autocomplete-opts.hide{:'data-autocomplete-path' => search_autocomplete_path, :'data-autocomplete-project-id' => @project.try(:id), :'data-autocomplete-project-ref' => @ref } - -:javascript - $('.search-input').on('keyup', function(e) { - if (e.keyCode == 27) { - $('.search-input').blur(); - } - }); diff --git a/app/views/shared/_location_badge.html.haml b/app/views/shared/_location_badge.html.haml new file mode 100644 index 00000000000..dfe8bc010d6 --- /dev/null +++ b/app/views/shared/_location_badge.html.haml @@ -0,0 +1,13 @@ +- if controller.controller_path =~ /^groups/ + - label = 'This group' +- if controller.controller_path =~ /^projects/ + - label = 'This project' + +.search-location-badge + - if label.present? + %span.label.label-primary + %i.location-text + = label + + %a.remove-badge{href: '#'} + x |