0001-Use-named-routes-for-search-in-base-layout.patch

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

Download (2.83 KB)

View differences:

app/views/layouts/base.html.erb
26 26

  
27 27
    <% if User.current.logged? || !Setting.login_required? %>
28 28
        <div class="flyout-menu__search">
29
            <%= form_tag({:controller => 'search', :action => 'index', :id => @project}, :method => :get ) do %>
29
            <%= form_tag(search_path(id: @project), :method => :get ) do %>
30 30
            <%= hidden_field_tag(controller.default_search_scope, 1, :id => nil) if controller.default_search_scope %>
31 31
            <%= label_tag 'flyout-search', '&#9906;'.html_safe, :class => 'search-magnifier search-magnifier--flyout' %>
32 32
            <%= text_field_tag 'q', @question, :id => 'flyout-search', :class => 'small js-search-input', :placeholder => l(:label_search) %>
......
74 74

  
75 75
    <% if User.current.logged? || !Setting.login_required? %>
76 76
    <div id="quick-search">
77
        <%= form_tag({:controller => 'search', :action => 'index', :id => @project}, :method => :get ) do %>
77
        <%= form_tag(search_path(id: @project), :method => :get ) do %>
78 78
        <%= hidden_field_tag(controller.default_search_scope, 1, :id => nil) if controller.default_search_scope %>
79 79
        <label for='q'>
80
          <%= link_to l(:label_search), {:controller => 'search', :action => 'index', :id => @project}, :accesskey => accesskey(:search) %>:
80
          <%= link_to l(:label_search), search_path(id: @project), :accesskey => accesskey(:search) %>:
81 81
        </label>
82 82
        <%= text_field_tag 'q', @question, :size => 20, :class => 'small', :accesskey => accesskey(:quick_search) %>
83 83
        <% end %>
config/routes.rb
336 336
  resources :enumerations, :except => :show
337 337
  match 'enumerations/:type', :to => 'enumerations#index', :via => :get
338 338

  
339
  get 'projects/:id/search', :controller => 'search', :action => 'index'
340
  get 'search', :controller => 'search', :action => 'index'
339
  get '(projects/:id)/search', :controller => 'search', :action => 'index', :as => 'search'
341 340

  
342 341

  
343 342
  get  'mail_handler', :to => 'mail_handler#new'
344
-