diff options
author | Duda Dornelles <ddornell@thoughtworks.com> | 2014-12-23 16:40:08 -0200 |
---|---|---|
committer | Duda Dornelles <ddornell@thoughtworks.com> | 2014-12-23 16:40:08 -0200 |
commit | d6fcbb1fbe3d791ed5da6935b9cc6190b56f01cb (patch) | |
tree | aeadd1cc50000a1dcab7434e0024bf652c3747a0 /web-ui/app/js/helpers | |
parent | 667c75e1af204dec1ab6b64c575ff17ffa2458aa (diff) |
#216 when trying to save a draft too fast (before the previous version is saved) simply ignore the attempt
Diffstat (limited to 'web-ui/app/js/helpers')
-rw-r--r-- | web-ui/app/js/helpers/monitored_ajax.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/web-ui/app/js/helpers/monitored_ajax.js b/web-ui/app/js/helpers/monitored_ajax.js index e8454ee6..42b2dcf7 100644 --- a/web-ui/app/js/helpers/monitored_ajax.js +++ b/web-ui/app/js/helpers/monitored_ajax.js @@ -32,7 +32,9 @@ define(['page/events', 'views/i18n'], function (events, i18n) { var originalBeforeSend = config.beforeSend; config.beforeSend = function () { - $('#loading').show(); + if (!config.skipLoadingWarning) { + $('#loading').show(); + } if (originalBeforeSend) { originalBeforeSend(); } @@ -40,15 +42,19 @@ define(['page/events', 'views/i18n'], function (events, i18n) { var originalComplete = config.complete; config.complete = function () { - $('#loading').fadeOut(500); + if (!config.skipLoadingWarning) { + $('#loading').fadeOut(500); + } if (originalComplete) { originalComplete(); } }; return $.ajax(url, config).fail(function (xmlhttprequest, textstatus, message) { - var msg = messages[textstatus] || 'unexpected problem while talking to server'; - on.trigger(document, events.ui.userAlerts.displayMessage, { message: i18n(msg) }); + if (!config.skipErrorMessage) { + var msg = messages[textstatus] || 'unexpected problem while talking to server'; + on.trigger(document, events.ui.userAlerts.displayMessage, { message: i18n(msg) }); + } }.bind(this)); } |