diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2014-10-04 09:14:17 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2014-10-04 09:14:17 +0000 |
commit | 2e9b28906db62f5ef5b2663f68d395a8e261959c (patch) | |
tree | 056539161b4f990d59dcb3482ae7c8b172b4417d /app | |
parent | efdf2584b68bfde062507965811f0f416f42dcbc (diff) | |
download | redmine-2e9b28906db62f5ef5b2663f68d395a8e261959c.tar.gz redmine-2e9b28906db62f5ef5b2663f68d395a8e261959c.zip |
Removes routes for time entries nested under project/issues.
git-svn-id: http://svn.redmine.org/redmine/trunk@13424 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/routes_helper.rb | 30 | ||||
-rw-r--r-- | app/views/timelog/_date_range.html.erb | 4 | ||||
-rw-r--r-- | app/views/timelog/index.html.erb | 4 | ||||
-rw-r--r-- | app/views/timelog/report.html.erb | 8 |
4 files changed, 38 insertions, 8 deletions
diff --git a/app/helpers/routes_helper.rb b/app/helpers/routes_helper.rb index 4ebce94ef..d1370229a 100644 --- a/app/helpers/routes_helper.rb +++ b/app/helpers/routes_helper.rb @@ -36,4 +36,34 @@ module RoutesHelper def _project_gantt_path(project, *args) project ? project_gantt_path(project, *args) : issues_gantt_path(*args) end + + def _time_entries_path(project, issue, *args) + if issue + issue_time_entries_path(issue, *args) + elsif project + project_time_entries_path(project, *args) + else + time_entries_path(*args) + end + end + + def _report_time_entries_path(project, issue, *args) + if issue + report_issue_time_entries_path(issue, *args) + elsif project + report_project_time_entries_path(project, *args) + else + report_time_entries_path(*args) + end + end + + def _new_time_entry_path(project, issue, *args) + if issue + new_issue_time_entry_path(issue, *args) + elsif project + new_project_time_entry_path(project, *args) + else + new_time_entry_path(*args) + end + end end diff --git a/app/views/timelog/_date_range.html.erb b/app/views/timelog/_date_range.html.erb index 2b3dbf268..0c72012c1 100644 --- a/app/views/timelog/_date_range.html.erb +++ b/app/views/timelog/_date_range.html.erb @@ -28,9 +28,9 @@ <div class="tabs hide-when-print"> <% query_params = params.slice(:f, :op, :v, :sort) %> <ul> - <li><%= link_to(l(:label_details), query_params.merge({:controller => 'timelog', :action => 'index', :project_id => @project, :issue_id => @issue }), + <li><%= link_to(l(:label_details), _time_entries_path(@project, @issue, query_params), :class => (action_name == 'index' ? 'selected' : nil)) %></li> - <li><%= link_to(l(:label_report), query_params.merge({:controller => 'timelog', :action => 'report', :project_id => @project, :issue_id => @issue}), + <li><%= link_to(l(:label_report), _report_time_entries_path(@project, @issue, query_params), :class => (action_name == 'report' ? 'selected' : nil)) %></li> </ul> </div> diff --git a/app/views/timelog/index.html.erb b/app/views/timelog/index.html.erb index fa0c20ff3..ad1854f36 100644 --- a/app/views/timelog/index.html.erb +++ b/app/views/timelog/index.html.erb @@ -1,6 +1,6 @@ <div class="contextual"> <%= link_to l(:button_log_time), - {:controller => 'timelog', :action => 'new', :project_id => @project, :issue_id => @issue}, + _new_time_entry_path(@project, @issue), :class => 'icon icon-time-add' if User.current.allowed_to?(:log_time, @project, :global => true) %> </div> @@ -8,7 +8,7 @@ <h2><%= l(:label_spent_time) %></h2> -<%= form_tag({:controller => 'timelog', :action => 'index', :project_id => @project, :issue_id => @issue}, :method => :get, :id => 'query_form') do %> +<%= form_tag(params.slice(:project_id, :issue_id), :method => :get, :id => 'query_form') do %> <%= render :partial => 'date_range' %> <% end %> diff --git a/app/views/timelog/report.html.erb b/app/views/timelog/report.html.erb index ac2637ef1..cb556a656 100644 --- a/app/views/timelog/report.html.erb +++ b/app/views/timelog/report.html.erb @@ -1,14 +1,14 @@ <div class="contextual"> -<%= link_to_if_authorized l(:button_log_time), {:controller => 'timelog', :action => 'new', :project_id => @project, :issue_id => @issue}, :class => 'icon icon-time-add' %> +<%= link_to l(:button_log_time), + _new_time_entry_path(@project, @issue), + :class => 'icon icon-time-add' if User.current.allowed_to?(:log_time, @project, :global => true) %> </div> <%= render_timelog_breadcrumb %> <h2><%= l(:label_spent_time) %></h2> -<%= form_tag({:controller => 'timelog', :action => 'report', - :project_id => @project, :issue_id => @issue}, - :method => :get, :id => 'query_form') do %> +<%= form_tag(params.slice(:project_id, :issue_id), :method => :get, :id => 'query_form') do %> <% @report.criteria.each do |criterion| %> <%= hidden_field_tag 'criteria[]', criterion, :id => nil %> <% end %> |