From: Jean-Philippe Lang Date: Sun, 23 Dec 2012 15:12:57 +0000 (+0000) Subject: Code cleanup, use named routes. X-Git-Tag: 2.3.0~393 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1528c719a425851dd8576773e30b4b64b9d4736e;p=redmine.git Code cleanup, use named routes. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11074 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb index 3317594ae..8452a02d2 100644 --- a/app/views/projects/show.html.erb +++ b/app/views/projects/show.html.erb @@ -1,6 +1,6 @@
<% if User.current.allowed_to?(:add_subprojects, @project) %> - <%= link_to l(:label_subproject_new), {:controller => 'projects', :action => 'new', :parent_id => @project}, :class => 'icon icon-add' %> + <%= link_to l(:label_subproject_new), new_project_path(:parent_id => @project), :class => 'icon icon-add' %> <% end %> <% if User.current.allowed_to?(:close_project, @project) %> <% if @project.active? %> @@ -29,7 +29,7 @@ <% end %> <% if @subprojects.any? %>
  • <%=l(:label_subproject_plural)%>: - <%= @subprojects.collect{|p| link_to(h(p), :action => 'show', :id => p)}.join(", ").html_safe %>
  • + <%= @subprojects.collect{|p| link_to p, project_path(p)}.join(", ").html_safe %> <% end %> <% @project.visible_custom_field_values.each do |custom_value| %> <% if !custom_value.value.blank? %> @@ -43,21 +43,19 @@

    <%=l(:label_issue_tracking)%>

    - <%= link_to l(:label_issue_view_all), :controller => 'issues', :action => 'index', :project_id => @project, :set_filter => 1 %> + <%= link_to l(:label_issue_view_all), project_issues_path(@project, :set_filter => 1) %> <% if User.current.allowed_to?(:view_calendar, @project, :global => true) %> - | <%= link_to(l(:label_calendar), :controller => 'calendars', :action => 'show', :project_id => @project) %> + | <%= link_to l(:label_calendar), project_calendar_path(@project) %> <% end %> <% if User.current.allowed_to?(:view_gantt, @project, :global => true) %> - | <%= link_to(l(:label_gantt), :controller => 'gantts', :action => 'show', :project_id => @project) %> + | <%= link_to l(:label_gantt), project_gantt_path(@project) %> <% end %>

    @@ -72,7 +70,7 @@

    <%=l(:label_news_latest)%>

    <%= render :partial => 'news/news', :collection => @news %> -

    <%= link_to l(:label_news_view_all), :controller => 'news', :action => 'index', :project_id => @project %>

    +

    <%= link_to l(:label_news_view_all), project_news_index_path(@project) %>

    <% end %> <%= call_hook(:view_projects_show_right, :project => @project) %> diff --git a/config/routes.rb b/config/routes.rb index ad1465f20..209c70162 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -51,10 +51,10 @@ RedmineApp::Application.routes.draw do match '/journals/diff/:id', :to => 'journals#diff', :id => /\d+/, :via => :get match '/journals/edit/:id', :to => 'journals#edit', :id => /\d+/, :via => [:get, :post] - get '/projects/:project_id/issues/gantt', :to => 'gantts#show' + get '/projects/:project_id/issues/gantt', :to => 'gantts#show', :as => 'project_gantt' get '/issues/gantt', :to => 'gantts#show' - get '/projects/:project_id/issues/calendar', :to => 'calendars#show' + get '/projects/:project_id/issues/calendar', :to => 'calendars#show', :as => 'project_calendar' get '/issues/calendar', :to => 'calendars#show' match 'projects/:id/issues/report', :to => 'reports#issue_report', :via => :get