summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2021-04-15 00:32:44 +0000
committerGo MAEDA <maeda@farend.jp>2021-04-15 00:32:44 +0000
commite65980dc0995ee94f399f2d7e0d1b56b8ac6af57 (patch)
treedf4625522b8260fed339d7da6c108c88cc4c241c
parentf2b17f77943959ea2a415f239ff50e2758c49859 (diff)
downloadredmine-e65980dc0995ee94f399f2d7e0d1b56b8ac6af57.tar.gz
redmine-e65980dc0995ee94f399f2d7e0d1b56b8ac6af57.zip
Use named routes in base layout and account sidebar (#35075).
Patch by Jan Schulz-Hofen. git-svn-id: http://svn.redmine.org/redmine/trunk@20944 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/views/layouts/base.html.erb6
-rw-r--r--app/views/my/_sidebar.html.erb2
-rw-r--r--config/routes.rb5
3 files changed, 6 insertions, 7 deletions
diff --git a/app/views/layouts/base.html.erb b/app/views/layouts/base.html.erb
index 45337ce7e..43e7459e7 100644
--- a/app/views/layouts/base.html.erb
+++ b/app/views/layouts/base.html.erb
@@ -26,7 +26,7 @@
<% 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) %>
@@ -74,11 +74,11 @@
<% 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 'scope', default_search_project_scope, :id => nil %>
<%= 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, :scope => default_search_project_scope}, :accesskey => accesskey(:search) %>:
+ <%= link_to l(:label_search), search_path(id: @project, :scope => default_search_project_scope), :accesskey => accesskey(:search) %>:
</label>
<%= text_field_tag 'q', @question, :size => 20, :class => 'small', :accesskey => accesskey(:quick_search),
:data => {
diff --git a/app/views/my/_sidebar.html.erb b/app/views/my/_sidebar.html.erb
index e962538b5..01ac5c6a5 100644
--- a/app/views/my/_sidebar.html.erb
+++ b/app/views/my/_sidebar.html.erb
@@ -4,7 +4,7 @@
<%=l(:field_created_on)%>: <%= format_time(@user.created_on) %></p>
<% if @user.own_account_deletable? %>
- <p><%= link_to(l(:button_delete_my_account), {:controller => 'my', :action => 'destroy'}, :class => 'icon icon-del') %></p>
+ <p><%= link_to(l(:button_delete_my_account), delete_my_account_path, :class => 'icon icon-del') %></p>
<% end %>
<h4><%= l(:label_feeds_access_key) %></h4>
diff --git a/config/routes.rb b/config/routes.rb
index be12e504e..dbcd8ddc7 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -83,7 +83,7 @@ Rails.application.routes.draw do
match '/imports/:id/run', :to => 'imports#run', :via => [:get, :post], :as => 'import_run'
match 'my/account', :controller => 'my', :action => 'account', :via => [:get, :put]
- match 'my/account/destroy', :controller => 'my', :action => 'destroy', :via => [:get, :post]
+ match 'my/account/destroy', :controller => 'my', :action => 'destroy', :via => [:get, :post], :as => :delete_my_account
match 'my/page', :controller => 'my', :action => 'page', :via => :get
post 'my/page', :to => 'my#update_page'
match 'my', :controller => 'my', :action => 'index', :via => :get # Redirects to my/page
@@ -349,8 +349,7 @@ Rails.application.routes.draw do
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'