Added a back_url field to the Rate for that will store the redirect path.
* Used in the User Administration panel so RatesController can redirect back to the panel as needed. #1914
This commit is contained in:
@@ -2,6 +2,7 @@ class RatesController < ApplicationController
|
||||
helper :users
|
||||
before_filter :require_admin
|
||||
before_filter :require_user_id, :only => [:index, :new]
|
||||
before_filter :set_back_url, :only => [:new, :edit]
|
||||
|
||||
# GET /rates?user_id=1
|
||||
# GET /rates.xml?user_id=1
|
||||
@@ -49,7 +50,13 @@ class RatesController < ApplicationController
|
||||
respond_to do |format|
|
||||
if @rate.save
|
||||
flash[:notice] = 'Rate was successfully created.'
|
||||
format.html { redirect_to(rates_url(:user_id => @rate.user_id)) }
|
||||
format.html {
|
||||
if params[:back_url] && !params[:back_url].blank?
|
||||
redirect_to(params[:back_url])
|
||||
else
|
||||
redirect_to(rates_url(:user_id => @rate.user_id))
|
||||
end
|
||||
}
|
||||
format.xml { render :xml => @rate, :status => :created, :location => @rate }
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
@@ -100,4 +107,8 @@ class RatesController < ApplicationController
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def set_back_url
|
||||
@back_url = params[:back_url]
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user