From 8c79385261d809504060ad103f58707680fcca70 Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Wed, 4 Aug 2010 13:37:44 +0000 Subject: [PATCH] Refactor: extract back_url method to ApplicationController. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3912 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/application_controller.rb | 4 ++++ app/controllers/issues_controller.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 6e5634db..c00b6ba4 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -218,6 +218,10 @@ class ApplicationController < ActionController::Base end end + def back_url + params[:back_url] || request.env['HTTP_REFERER'] + end + def redirect_back_or_default(default) back_url = CGI.unescape(params[:back_url].to_s) if !back_url.blank? diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 8b5d73fa..d73dfebf 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -349,7 +349,7 @@ class IssuesController < ApplicationController @priorities = IssuePriority.all.reverse @statuses = IssueStatus.find(:all, :order => 'position') - @back = params[:back_url] || request.env['HTTP_REFERER'] + @back = back_url render :layout => false end