Extract search field into a partial

This commit is contained in:
Riyad Preukschas 2012-10-11 23:41:49 +02:00
parent 0e0c5c53a3
commit ff396e0a7e
2 changed files with 12 additions and 11 deletions

View file

@ -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 }
});
});

View 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 }
});
});