修改403,404页面添加layout,传入一些其他参数
This commit is contained in:
parent
82aa52e44f
commit
491020b6df
|
@ -499,19 +499,19 @@ class ApplicationController < ActionController::Base
|
||||||
|
|
||||||
def render_403(options={})
|
def render_403(options={})
|
||||||
@project = nil
|
@project = nil
|
||||||
#render_error({:message => :notice_not_authorized, :status => 403}.merge(options))
|
render_error({:message => :notice_not_authorized, :status => 403}.merge(options),'common/403')
|
||||||
render :template => 'common/403'
|
#render :template => 'common/403'
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_404(options={})
|
def render_404(options={})
|
||||||
#render_error({:message => :notice_file_not_found, :status => 404}.merge(options))
|
render_error({:message => :notice_file_not_found, :status => 404}.merge(options),'common/404')
|
||||||
render :template => 'common/404'
|
#render :template => 'common/404'
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
# Renders an error response
|
# Renders an error response
|
||||||
def render_error(arg)
|
def render_error(arg,template = 'common/error')
|
||||||
arg = {:message => arg} unless arg.is_a?(Hash)
|
arg = {:message => arg} unless arg.is_a?(Hash)
|
||||||
@message = arg[:message]
|
@message = arg[:message]
|
||||||
@lay = arg[:layout]
|
@lay = arg[:layout]
|
||||||
|
@ -521,9 +521,9 @@ class ApplicationController < ActionController::Base
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html {
|
format.html {
|
||||||
if @lay
|
if @lay
|
||||||
render :template => 'common/error', :layout => @lay,:status => @status
|
render :template => template, :layout => @lay,:status => @status
|
||||||
else
|
else
|
||||||
render :template => 'common/error', :layout => use_layout, :status => @status
|
render :template => template, :layout => use_layout, :status => @status
|
||||||
end
|
end
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue