diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-12-23 15:55:57 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-12-23 15:55:57 +0000 |
commit | 4ac43ab876319acb828aedc1c7cc0210f4cb0d9e (patch) | |
tree | df6f5c6a854d00911a4648b95f6842f5af4e9eec /app | |
parent | 3ef7f5855edc1193755097a4ef981ff67ea4ae56 (diff) | |
download | redmine-4ac43ab876319acb828aedc1c7cc0210f4cb0d9e.tar.gz redmine-4ac43ab876319acb828aedc1c7cc0210f4cb0d9e.zip |
Code cleanup, use named routes.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11077 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/reports_helper.rb | 5 | ||||
-rw-r--r-- | app/helpers/routes_helper.rb | 8 | ||||
-rw-r--r-- | app/views/issues/_sidebar.html.erb | 8 | ||||
-rw-r--r-- | app/views/reports/_details.html.erb | 33 | ||||
-rw-r--r-- | app/views/reports/_simple.html.erb | 26 | ||||
-rw-r--r-- | app/views/reports/issue_report.html.erb | 14 | ||||
-rw-r--r-- | app/views/reports/issue_report_details.html.erb | 2 |
7 files changed, 34 insertions, 62 deletions
diff --git a/app/helpers/reports_helper.rb b/app/helpers/reports_helper.rb index 545f4d034..756f0a811 100644 --- a/app/helpers/reports_helper.rb +++ b/app/helpers/reports_helper.rb @@ -35,4 +35,9 @@ module ReportsHelper a = aggregate data, criteria a > 0 ? link_to(h(a), *args) : '-' end + + def aggregate_path(project, field, row, options={}) + parameters = {:set_filter => 1, :subproject_id => '!*', field => row.id}.merge(options) + project_issues_path(row.is_a?(Project) ? row : project, parameters) + end end diff --git a/app/helpers/routes_helper.rb b/app/helpers/routes_helper.rb index f52dc6df0..afb77aa8b 100644 --- a/app/helpers/routes_helper.rb +++ b/app/helpers/routes_helper.rb @@ -28,4 +28,12 @@ module RoutesHelper issues_path(*args) end end + + def _project_calendar_path(project, *args) + project ? project_calendar_path(project, *args) : issues_calendar_path(*args) + end + + def _project_gantt_path(project, *args) + project ? project_gantt_path(project, *args) : issues_gantt_path(*args) + end end diff --git a/app/views/issues/_sidebar.html.erb b/app/views/issues/_sidebar.html.erb index c7b4a6a34..24b8a4fa4 100644 --- a/app/views/issues/_sidebar.html.erb +++ b/app/views/issues/_sidebar.html.erb @@ -1,15 +1,15 @@ <h3><%= l(:label_issue_plural) %></h3> -<%= link_to l(:label_issue_view_all), { :controller => 'issues', :action => 'index', :project_id => @project, :set_filter => 1 } %><br /> +<%= link_to l(:label_issue_view_all), _project_issues_path(@project, :set_filter => 1) %><br /> <% if @project %> -<%= link_to l(:field_summary), :controller => 'reports', :action => 'issue_report', :id => @project %><br /> +<%= link_to l(:field_summary), project_issues_report_path(@project) %><br /> <% end %> <%= call_hook(:view_issues_sidebar_issues_bottom) %> <% if User.current.allowed_to?(:view_calendar, @project, :global => true) %> - <%= link_to(l(:label_calendar), :controller => 'calendars', :action => 'show', :project_id => @project) %><br /> + <%= link_to l(:label_calendar), _project_calendar_path(@project) %><br /> <% end %> <% if User.current.allowed_to?(:view_gantt, @project, :global => true) %> - <%= link_to(l(:label_gantt), :controller => 'gantts', :action => 'show', :project_id => @project) %><br /> + <%= link_to l(:label_gantt), _project_gantt_path(@project) %><br /> <% end %> <%= call_hook(:view_issues_sidebar_planning_bottom) %> diff --git a/app/views/reports/_details.html.erb b/app/views/reports/_details.html.erb index 47eda9909..4a01c7333 100644 --- a/app/views/reports/_details.html.erb +++ b/app/views/reports/_details.html.erb @@ -15,36 +15,13 @@ <tbody> <% for row in rows %> <tr class="<%= cycle("odd", "even") %>"> - <td><%= link_to h(row.name), :controller => 'issues', :action => 'index', :project_id => ((row.is_a?(Project) ? row : @project)), - :set_filter => 1, - :subproject_id => '!*', - "#{field_name}" => row.id %></td> + <td><%= link_to h(row.name), aggregate_path(@project, field_name, row) %></td> <% for status in @statuses %> - <td align="center"><%= aggregate_link data, { field_name => row.id, "status_id" => status.id }, - :controller => 'issues', :action => 'index', :project_id => ((row.is_a?(Project) ? row : @project)), - :set_filter => 1, - :subproject_id => '!*', - "status_id" => status.id, - "#{field_name}" => row.id %></td> + <td align="center"><%= aggregate_link data, { field_name => row.id, "status_id" => status.id }, aggregate_path(@project, field_name, row, :status_id => status.id) %></td> <% end %> - <td align="center"><%= aggregate_link data, { field_name => row.id, "closed" => 0 }, - :controller => 'issues', :action => 'index', :project_id => ((row.is_a?(Project) ? row : @project)), - :set_filter => 1, - :subproject_id => '!*', - "#{field_name}" => row.id, - "status_id" => "o" %></td> - <td align="center"><%= aggregate_link data, { field_name => row.id, "closed" => 1 }, - :controller => 'issues', :action => 'index', :project_id => ((row.is_a?(Project) ? row : @project)), - :set_filter => 1, - :subproject_id => '!*', - "#{field_name}" => row.id, - "status_id" => "c" %></td> - <td align="center"><%= aggregate_link data, { field_name => row.id }, - :controller => 'issues', :action => 'index', :project_id => ((row.is_a?(Project) ? row : @project)), - :set_filter => 1, - :subproject_id => '!*', - "#{field_name}" => row.id, - "status_id" => "*" %></td> + <td align="center"><%= aggregate_link data, { field_name => row.id, "closed" => 0 }, aggregate_path(@project, field_name, row, :status_id => "o") %></td> + <td align="center"><%= aggregate_link data, { field_name => row.id, "closed" => 1 }, aggregate_path(@project, field_name, row, :status_id => "c") %></td> + <td align="center"><%= aggregate_link data, { field_name => row.id }, aggregate_path(@project, field_name, row, :status_id => "*") %></td> </tr> <% end %> </tbody> diff --git a/app/views/reports/_simple.html.erb b/app/views/reports/_simple.html.erb index 46f4a9fd4..8ea18f16f 100644 --- a/app/views/reports/_simple.html.erb +++ b/app/views/reports/_simple.html.erb @@ -11,28 +11,10 @@ <tbody> <% for row in rows %> <tr class="<%= cycle("odd", "even") %>"> - <td><%= link_to h(row.name), :controller => 'issues', :action => 'index', :project_id => ((row.is_a?(Project) ? row : @project)), - :set_filter => 1, - :subproject_id => '!*', - "#{field_name}" => row.id %></td> - <td align="center"><%= aggregate_link data, { field_name => row.id, "closed" => 0 }, - :controller => 'issues', :action => 'index', :project_id => ((row.is_a?(Project) ? row : @project)), - :set_filter => 1, - :subproject_id => '!*', - "#{field_name}" => row.id, - "status_id" => "o" %></td> - <td align="center"><%= aggregate_link data, { field_name => row.id, "closed" => 1 }, - :controller => 'issues', :action => 'index', :project_id => ((row.is_a?(Project) ? row : @project)), - :set_filter => 1, - :subproject_id => '!*', - "#{field_name}" => row.id, - "status_id" => "c" %></td> - <td align="center"><%= aggregate_link data, { field_name => row.id }, - :controller => 'issues', :action => 'index', :project_id => ((row.is_a?(Project) ? row : @project)), - :set_filter => 1, - :subproject_id => '!*', - "#{field_name}" => row.id, - "status_id" => "*" %></td> + <td><%= link_to h(row.name), aggregate_path(@project, field_name, row) %></td> + <td align="center"><%= aggregate_link data, { field_name => row.id, "closed" => 0 }, aggregate_path(@project, field_name, row, :status_id => "o") %></td> + <td align="center"><%= aggregate_link data, { field_name => row.id, "closed" => 1 }, aggregate_path(@project, field_name, row, :status_id => "c") %></td> + <td align="center"><%= aggregate_link data, { field_name => row.id }, aggregate_path(@project, field_name, row, :status_id => "*") %></td> </tr> <% end %> </tbody> diff --git a/app/views/reports/issue_report.html.erb b/app/views/reports/issue_report.html.erb index d70d429bb..d40841dae 100644 --- a/app/views/reports/issue_report.html.erb +++ b/app/views/reports/issue_report.html.erb @@ -1,31 +1,31 @@ <h2><%=l(:label_report_plural)%></h2> <div class="splitcontentleft"> -<h3><%=l(:field_tracker)%> <%= link_to image_tag('zoom_in.png'), :action => 'issue_report_details', :detail => 'tracker' %></h3> +<h3><%=l(:field_tracker)%> <%= link_to image_tag('zoom_in.png'), project_issues_report_details_path(@project, :detail => 'tracker') %></h3> <%= render :partial => 'simple', :locals => { :data => @issues_by_tracker, :field_name => "tracker_id", :rows => @trackers } %> <br /> -<h3><%=l(:field_priority)%> <%= link_to image_tag('zoom_in.png'), :action => 'issue_report_details', :detail => 'priority' %></h3> +<h3><%=l(:field_priority)%> <%= link_to image_tag('zoom_in.png'), project_issues_report_details_path(@project, :detail => 'priority') %></h3> <%= render :partial => 'simple', :locals => { :data => @issues_by_priority, :field_name => "priority_id", :rows => @priorities } %> <br /> -<h3><%=l(:field_assigned_to)%> <%= link_to image_tag('zoom_in.png'), :action => 'issue_report_details', :detail => 'assigned_to' %></h3> +<h3><%=l(:field_assigned_to)%> <%= link_to image_tag('zoom_in.png'), project_issues_report_details_path(@project, :detail => 'assigned_to') %></h3> <%= render :partial => 'simple', :locals => { :data => @issues_by_assigned_to, :field_name => "assigned_to_id", :rows => @assignees } %> <br /> -<h3><%=l(:field_author)%> <%= link_to image_tag('zoom_in.png'), :action => 'issue_report_details', :detail => 'author' %></h3> +<h3><%=l(:field_author)%> <%= link_to image_tag('zoom_in.png'), project_issues_report_details_path(@project, :detail => 'author') %></h3> <%= render :partial => 'simple', :locals => { :data => @issues_by_author, :field_name => "author_id", :rows => @authors } %> <br /> <%= call_hook(:view_reports_issue_report_split_content_left, :project => @project) %> </div> <div class="splitcontentright"> -<h3><%=l(:field_version)%> <%= link_to image_tag('zoom_in.png'), :action => 'issue_report_details', :detail => 'version' %></h3> +<h3><%=l(:field_version)%> <%= link_to image_tag('zoom_in.png'), project_issues_report_details_path(@project, :detail => 'version') %></h3> <%= render :partial => 'simple', :locals => { :data => @issues_by_version, :field_name => "fixed_version_id", :rows => @versions } %> <br /> <% if @project.children.any? %> -<h3><%=l(:field_subproject)%> <%= link_to image_tag('zoom_in.png'), :action => 'issue_report_details', :detail => 'subproject' %></h3> +<h3><%=l(:field_subproject)%> <%= link_to image_tag('zoom_in.png'), project_issues_report_details_path(@project, :detail => 'subproject') %></h3> <%= render :partial => 'simple', :locals => { :data => @issues_by_subproject, :field_name => "project_id", :rows => @subprojects } %> <br /> <% end %> -<h3><%=l(:field_category)%> <%= link_to image_tag('zoom_in.png'), :action => 'issue_report_details', :detail => 'category' %></h3> +<h3><%=l(:field_category)%> <%= link_to image_tag('zoom_in.png'), project_issues_report_details_path(@project, :detail => 'category') %></h3> <%= render :partial => 'simple', :locals => { :data => @issues_by_category, :field_name => "category_id", :rows => @categories } %> <br /> <%= call_hook(:view_reports_issue_report_split_content_right, :project => @project) %> diff --git a/app/views/reports/issue_report_details.html.erb b/app/views/reports/issue_report_details.html.erb index 6b4b42232..be7259d6b 100644 --- a/app/views/reports/issue_report_details.html.erb +++ b/app/views/reports/issue_report_details.html.erb @@ -3,5 +3,5 @@ <h3><%=@report_title%></h3> <%= render :partial => 'details', :locals => { :data => @data, :field_name => @field, :rows => @rows } %> <br /> -<%= link_to l(:button_back), :action => 'issue_report' %> +<%= link_to l(:button_back), project_issues_report_path(@project) %> |