Adds JS response support to #render_error (#15760).

git-svn-id: http://svn.redmine.org/redmine/trunk@12855 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2014-02-07 09:26:27 +00:00
parent 171581da7e
commit 3d64938adc
2 changed files with 5 additions and 0 deletions

View File

@ -431,6 +431,10 @@ class ApplicationController < ActionController::Base
format.html {
render :template => 'common/error', :layout => use_layout, :status => @status
}
format.js {
# Can't use an error status here, browsers wouldn't execute the JS response
render :template => 'common/error', :layout => false, :status => 200
}
format.any { head @status }
end
end

View File

@ -0,0 +1 @@
alert("<%= raw escape_javascript @message %> (<%= raw escape_javascript @status.to_s %>)");