Commit ff396e0a7eb504e62c79277d2697cbc8c7c9e660

Authored by Riyad Preukschas
1 parent 0e0c5c53

Extract search field into a partial

app/views/layouts/_head_panel.html.haml
... ... @@ -8,9 +8,7 @@
8 8 GITLAB
9 9 %span.separator
10 10 %h1.project_name= title
11   - .search
12   - = form_tag search_path, method: :get do |f|
13   - = text_field_tag "search", nil, placeholder: "Search", class: "search-input"
  11 + = render "layouts/search"
14 12 .fbtn
15 13 - if current_user.is_admin?
16 14 = link_to admin_root_path, class: "btn small", title: "Admin area" do
... ... @@ -29,11 +27,3 @@
29 27 = link_to 'Logout', destroy_user_session_path, class: "logout", method: :delete
30 28  
31 29 = render "layouts/init_auto_complete"
32   -
33   -:javascript
34   - $(function(){
35   - $("#search").autocomplete({
36   - source: #{raw search_autocomplete_source},
37   - select: function(event, ui) { location.href = ui.item.url }
38   - });
39   - });
... ...
app/views/layouts/_search.html.haml 0 → 100644
... ... @@ -0,0 +1,11 @@
  1 +.search
  2 + = form_tag search_path, method: :get do |f|
  3 + = text_field_tag "search", nil, placeholder: "Search", class: "search-input"
  4 +
  5 +:javascript
  6 + $(function(){
  7 + $("#search").autocomplete({
  8 + source: #{raw search_autocomplete_source},
  9 + select: function(event, ui) { location.href = ui.item.url }
  10 + });
  11 + });
... ...