修改403,404页面添加layout,传入一些其他参数
This commit is contained in:
parent
82aa52e44f
commit
491020b6df
|
@ -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
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue