Project

General

Profile

Feature #24808 » 0001-Use-named-routes-for-search-in-base-layout.patch

Jan from Planio www.plan.io, 2017-01-18 17:46

View differences:

app/views/layouts/base.html.erb
<% if User.current.logged? || !Setting.login_required? %>
<div class="flyout-menu__search">
<%= form_tag({:controller => 'search', :action => 'index', :id => @project}, :method => :get ) do %>
<%= form_tag(search_path(id: @project), :method => :get ) do %>
<%= hidden_field_tag(controller.default_search_scope, 1, :id => nil) if controller.default_search_scope %>
<%= label_tag 'flyout-search', '&#9906;'.html_safe, :class => 'search-magnifier search-magnifier--flyout' %>
<%= text_field_tag 'q', @question, :id => 'flyout-search', :class => 'small js-search-input', :placeholder => l(:label_search) %>
......
<% if User.current.logged? || !Setting.login_required? %>
<div id="quick-search">
<%= form_tag({:controller => 'search', :action => 'index', :id => @project}, :method => :get ) do %>
<%= form_tag(search_path(id: @project), :method => :get ) do %>
<%= hidden_field_tag(controller.default_search_scope, 1, :id => nil) if controller.default_search_scope %>
<label for='q'>
<%= link_to l(:label_search), {:controller => 'search', :action => 'index', :id => @project}, :accesskey => accesskey(:search) %>:
<%= link_to l(:label_search), search_path(id: @project), :accesskey => accesskey(:search) %>:
</label>
<%= text_field_tag 'q', @question, :size => 20, :class => 'small', :accesskey => accesskey(:quick_search) %>
<% end %>
config/routes.rb
resources :enumerations, :except => :show
match 'enumerations/:type', :to => 'enumerations#index', :via => :get
get 'projects/:id/search', :controller => 'search', :action => 'index'
get 'search', :controller => 'search', :action => 'index'
get '(projects/:id)/search', :controller => 'search', :action => 'index', :as => 'search'
get 'mail_handler', :to => 'mail_handler#new'
(6-6/28)