mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
MINOR Using global ajaxComplete handlers for LeftAndMain instead of limiting to error handlers to allow usage of X-Status messages throughout the CMS
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@92827 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
26df8bd9af
commit
233e6e970f
@ -5,19 +5,21 @@
|
|||||||
var ss_MainLayout;
|
var ss_MainLayout;
|
||||||
|
|
||||||
(function($) {
|
(function($) {
|
||||||
|
$(function() {
|
||||||
|
// global ajax error handlers
|
||||||
|
$('.LeftAndMain').bind('ajaxComplete', function(e, xmlhttp, settings) {
|
||||||
|
var status = (xmlhttp.status >= 400) ? 'bad' : 'good';
|
||||||
|
var msg = (xmlhttp.getResponseHeader('X-Status')) ? xmlhttp.getResponseHeader('X-Status') : xmlhttp.statusText;
|
||||||
|
// Don't display standard '200 OK' messages
|
||||||
|
if(msg && msg != 'OK') statusMessage(msg, status);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
$.concrete('ss', function($){
|
$.concrete('ss', function($){
|
||||||
|
|
||||||
// setup jquery.concrete
|
// setup jquery.concrete
|
||||||
$.concrete.warningLevel = $.concrete.WARN_LEVEL_BESTPRACTISE;
|
$.concrete.warningLevel = $.concrete.WARN_LEVEL_BESTPRACTISE;
|
||||||
|
|
||||||
// global ajax error handlers
|
|
||||||
$.ajaxSetup({
|
|
||||||
error: function(xmlhttp, status, error) {
|
|
||||||
var msg = (xmlhttp.getResponseHeader('X-Status')) ? xmlhttp.getResponseHeader('X-Status') : xmlhttp.statusText;
|
|
||||||
statusMessage(msg, 'bad');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Available Custom Events:
|
* Available Custom Events:
|
||||||
* <ul>
|
* <ul>
|
||||||
|
Loading…
Reference in New Issue
Block a user