diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-01-30 21:24:18 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-01-30 21:24:18 +0000 |
commit | 252804f7da50f73ed7de9561c87c5a34140d2eab (patch) | |
tree | 1000feb3c449495c54dc0b7e3bfb2757b66bf847 | |
parent | be6199add30b888fb6706a9f7c0010750bda7460 (diff) | |
download | redmine-252804f7da50f73ed7de9561c87c5a34140d2eab.tar.gz redmine-252804f7da50f73ed7de9561c87c5a34140d2eab.zip |
Redirect to the parent issue after adding a subtask.
git-svn-id: http://svn.redmine.org/redmine/trunk@16317 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/controllers/issues_controller.rb | 13 | ||||
-rw-r--r-- | app/helpers/issues_helper.rb | 2 | ||||
-rw-r--r-- | app/views/issues/_form.html.erb | 1 |
3 files changed, 10 insertions, 6 deletions
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index efd221087..ee24d53a1 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -578,15 +578,18 @@ class IssuesController < ApplicationController # Redirects user after a successful issue creation def redirect_after_create if params[:continue] - attrs = {:tracker_id => @issue.tracker, :parent_issue_id => @issue.parent_issue_id}.reject {|k,v| v.nil?} + url_params = {} + url_params[:issue] = {:tracker_id => @issue.tracker, :parent_issue_id => @issue.parent_issue_id}.reject {|k,v| v.nil?} + url_params[:back_url] = params[:back_url].presence + if params[:project_id] - redirect_to new_project_issue_path(@issue.project, :issue => attrs) + redirect_to new_project_issue_path(@issue.project, url_params) else - attrs.merge! :project_id => @issue.project_id - redirect_to new_issue_path(:issue => attrs) + url_params[:issue].merge! :project_id => @issue.project_id + redirect_to new_issue_path(url_params) end else - redirect_to issue_path(@issue) + redirect_back_or_default issue_path(@issue) end end end diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index bf692285b..f95338284 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -184,7 +184,7 @@ module IssuesHelper :parent_issue_id => issue } attrs[:tracker_id] = issue.tracker unless issue.tracker.disabled_core_fields.include?('parent_issue_id') - link_to(l(:button_add), new_project_issue_path(issue.project, :issue => attrs)) + link_to(l(:button_add), new_project_issue_path(issue.project, :issue => attrs, :back_url => issue_path(issue))) end def trackers_options_for_select(issue) diff --git a/app/views/issues/_form.html.erb b/app/views/issues/_form.html.erb index f11c71faf..011928db8 100644 --- a/app/views/issues/_form.html.erb +++ b/app/views/issues/_form.html.erb @@ -1,6 +1,7 @@ <%= labelled_fields_for :issue, @issue do |f| %> <%= call_hook(:view_issues_form_details_top, { :issue => @issue, :form => f }) %> <%= hidden_field_tag 'form_update_triggered_by', '' %> +<%= hidden_field_tag 'back_url', params[:back_url], :id => nil if params[:back_url].present? %> <% if @issue.safe_attribute? 'is_private' %> <p id="issue_is_private_wrap"> |