Extract search field into a partial
This commit is contained in:
parent
0e0c5c53a3
commit
ff396e0a7e
|
@ -8,9 +8,7 @@
|
|||
GITLAB
|
||||
%span.separator
|
||||
%h1.project_name= title
|
||||
.search
|
||||
= form_tag search_path, method: :get do |f|
|
||||
= text_field_tag "search", nil, placeholder: "Search", class: "search-input"
|
||||
= render "layouts/search"
|
||||
.fbtn
|
||||
- if current_user.is_admin?
|
||||
= link_to admin_root_path, class: "btn small", title: "Admin area" do
|
||||
|
@ -29,11 +27,3 @@
|
|||
= link_to 'Logout', destroy_user_session_path, class: "logout", method: :delete
|
||||
|
||||
= render "layouts/init_auto_complete"
|
||||
|
||||
:javascript
|
||||
$(function(){
|
||||
$("#search").autocomplete({
|
||||
source: #{raw search_autocomplete_source},
|
||||
select: function(event, ui) { location.href = ui.item.url }
|
||||
});
|
||||
});
|
||||
|
|
11
app/views/layouts/_search.html.haml
Normal file
11
app/views/layouts/_search.html.haml
Normal file
|
@ -0,0 +1,11 @@
|
|||
.search
|
||||
= form_tag search_path, method: :get do |f|
|
||||
= text_field_tag "search", nil, placeholder: "Search", class: "search-input"
|
||||
|
||||
:javascript
|
||||
$(function(){
|
||||
$("#search").autocomplete({
|
||||
source: #{raw search_autocomplete_source},
|
||||
select: function(event, ui) { location.href = ui.item.url }
|
||||
});
|
||||
});
|
Loading…
Reference in a new issue