diff options
author | Fatih Acet <acetfatih@gmail.com> | 2016-06-21 00:05:33 +0300 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2016-06-21 22:20:42 +0300 |
commit | 1898cb03d0c31534d8d82ef389e6858e1e6c6185 (patch) | |
tree | 046f52b94743b69b85725bf4a9f7f64a9324b03f /app | |
parent | 2527ae6c60bbd230ccca11ef24deec24cdc50742 (diff) | |
download | gitlab-ce-global-ajax-error-handler.tar.gz |
Added global ajax error handler to show a flash notification for failed requests.global-ajax-error-handler
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/application.js.coffee | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/assets/javascripts/application.js.coffee b/app/assets/javascripts/application.js.coffee index 0206db461da..0b68612430d 100644 --- a/app/assets/javascripts/application.js.coffee +++ b/app/assets/javascripts/application.js.coffee @@ -185,6 +185,15 @@ $ -> else buttons.enable() + $(document).ajaxError (e, xhrObj, xhrSetting, xhrErrorText) -> + + if xhrObj.status is 401 + new Flash 'You need to be logged in.', 'alert' + + else if xhrObj.status in [ 404, 500 ] + new Flash 'Something went wrong on our end.', 'alert' + + # Show/Hide the profile menu when hovering the account box $('.account-box').hover -> $(@).toggleClass('hover') |