From dc2acb18eefe2dd2db793fb85e92cfe26911d37a Mon Sep 17 00:00:00 2001 From: David Baumgold Date: Mon, 20 May 2013 10:23:58 -0400 Subject: [PATCH] Moved global AJAX Error handler definition to main.coffee --- cms/static/coffee/src/main.coffee | 7 +++++++ cms/templates/base.html | 10 ---------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/cms/static/coffee/src/main.coffee b/cms/static/coffee/src/main.coffee index 8c23d6ac99..083a005c71 100644 --- a/cms/static/coffee/src/main.coffee +++ b/cms/static/coffee/src/main.coffee @@ -15,6 +15,13 @@ $ -> headers : { 'X-CSRFToken': $.cookie 'csrftoken' } dataType: 'json' + $(document).ajaxError (event, jqXHR, ajaxSettings, thrownError) -> + msg = new CMS.Models.ErrorMessage( + "title": gettext("Studio's having trouble saving your work") + "message": jqXHR.responseText || gettext("This may be happening because of an error with our server or your internet connection. Try refreshing the page or making sure you are online.") + ) + new CMS.Views.Notification({model: msg}) + window.onTouchBasedDevice = -> navigator.userAgent.match /iPhone|iPod|iPad/i diff --git a/cms/templates/base.html b/cms/templates/base.html index 61f52ed6d1..5fa347b6bf 100644 --- a/cms/templates/base.html +++ b/cms/templates/base.html @@ -60,16 +60,6 @@ -