Moved global AJAX Error handler definition to main.coffee

This commit is contained in:
David Baumgold
2013-05-20 10:23:58 -04:00
parent f3523d805f
commit dc2acb18ee
2 changed files with 7 additions and 10 deletions

View File

@@ -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

View File

@@ -60,16 +60,6 @@
<script src="${static.url('js/models/feedback.js')}"></script>
<script src="${static.url('js/views/feedback.js')}"></script>
<script type="text/javascript">
$(document).ajaxError(function(event, jqXHR, ajaxSettings, thrownError) {
var 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});
return msg;
})
</script>
<!-- view -->
<div class="wrapper wrapper-view">