修改403,404页面添加layout,传入一些其他参数

This commit is contained in:
z9hang 2014-10-22 14:53:54 +08:00
parent 82aa52e44f
commit 491020b6df
1 changed files with 7 additions and 7 deletions

View File

@ -499,19 +499,19 @@ class ApplicationController < ActionController::Base
def render_403(options={})
@project = nil
#render_error({:message => :notice_not_authorized, :status => 403}.merge(options))
render :template => 'common/403'
render_error({:message => :notice_not_authorized, :status => 403}.merge(options),'common/403')
#render :template => 'common/403'
return false
end
def render_404(options={})
#render_error({:message => :notice_file_not_found, :status => 404}.merge(options))
render :template => 'common/404'
render_error({:message => :notice_file_not_found, :status => 404}.merge(options),'common/404')
#render :template => 'common/404'
return false
end
# Renders an error response
def render_error(arg)
def render_error(arg,template = 'common/error')
arg = {:message => arg} unless arg.is_a?(Hash)
@message = arg[:message]
@lay = arg[:layout]
@ -521,9 +521,9 @@ class ApplicationController < ActionController::Base
respond_to do |format|
format.html {
if @lay
render :template => 'common/error', :layout => @lay,:status => @status
render :template => template, :layout => @lay,:status => @status
else
render :template => 'common/error', :layout => use_layout, :status => @status
render :template => template, :layout => use_layout, :status => @status
end
}