diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-12-11 19:39:47 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-12-11 19:39:47 +0000 |
commit | 8ab9215ea8df2216ccfacf272804811b05ab82c8 (patch) | |
tree | ac9ab871a1f9fc1a190cd6505ee08e8efacf8863 /app/controllers/issues_controller.rb | |
parent | 60d06d8c17290f536cf76ffd4a75bdafe540aa9a (diff) | |
download | redmine-8ab9215ea8df2216ccfacf272804811b05ab82c8.tar.gz redmine-8ab9215ea8df2216ccfacf272804811b05ab82c8.zip |
Use named routes in controllers.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10983 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/issues_controller.rb')
-rw-r--r-- | app/controllers/issues_controller.rb | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 455d2e3d5..a48ded5ee 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -145,8 +145,12 @@ class IssuesController < ApplicationController format.html { render_attachment_warning_if_needed(@issue) flash[:notice] = l(:notice_issue_successful_create, :id => view_context.link_to("##{@issue.id}", issue_path(@issue), :title => @issue.subject)) - redirect_to(params[:continue] ? { :action => 'new', :project_id => @issue.project, :issue => {:tracker_id => @issue.tracker, :parent_issue_id => @issue.parent_issue_id}.reject {|k,v| v.nil?} } : - { :action => 'show', :id => @issue }) + if params[:continue] + attrs = {:tracker_id => @issue.tracker, :parent_issue_id => @issue.parent_issue_id}.reject {|k,v| v.nil?} + redirect_to new_project_issue_path(@issue.project, :issue => attrs) + else + redirect_to issue_path(@issue) + end } format.api { render :action => 'show', :status => :created, :location => issue_url(@issue) } end @@ -187,7 +191,7 @@ class IssuesController < ApplicationController flash[:notice] = l(:notice_successful_update) unless @issue.current_journal.new_record? respond_to do |format| - format.html { redirect_back_or_default({:action => 'show', :id => @issue}) } + format.html { redirect_back_or_default issue_path(@issue) } format.api { render_api_ok } end else @@ -270,12 +274,12 @@ class IssuesController < ApplicationController if params[:follow] if @issues.size == 1 && moved_issues.size == 1 - redirect_to :controller => 'issues', :action => 'show', :id => moved_issues.first + redirect_to issue_path(moved_issues.first) elsif moved_issues.map(&:project).uniq.size == 1 - redirect_to :controller => 'issues', :action => 'index', :project_id => moved_issues.map(&:project).first + redirect_to project_issues_path(moved_issues.map(&:project).first) end else - redirect_back_or_default({:controller => 'issues', :action => 'index', :project_id => @project}) + redirect_back_or_default _issues_path(@project) end end @@ -308,7 +312,7 @@ class IssuesController < ApplicationController end end respond_to do |format| - format.html { redirect_back_or_default(:action => 'index', :project_id => @project) } + format.html { redirect_back_or_default _issues_path(@project) } format.api { render_api_ok } end end |