diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2017-06-07 16:30:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-07 16:30:27 +0200 |
commit | 7bb3aa31776ffce2735a3b16f6ad80bb17946d4d (patch) | |
tree | 5dd6bae023e67731479a8f799f3e00780ac98c56 /app/Resources | |
parent | c0d756f67d1cc0fc6832d404a09729f9219f0595 (diff) | |
parent | c406cef5b69b0d6c43adef33b5374b209347b637 (diff) | |
download | wallabag-7bb3aa31776ffce2735a3b16f6ad80bb17946d4d.tar.gz wallabag-7bb3aa31776ffce2735a3b16f6ad80bb17946d4d.tar.zst wallabag-7bb3aa31776ffce2735a3b16f6ad80bb17946d4d.zip |
Merge pull request #3093 from aaa2000/annotation-error-on-save
Displays an error with an annotation with a too long quote
Diffstat (limited to 'app/Resources')
-rw-r--r-- | app/Resources/static/themes/_global/index.js | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/app/Resources/static/themes/_global/index.js b/app/Resources/static/themes/_global/index.js index 3fdcaa3d..3ec26488 100644 --- a/app/Resources/static/themes/_global/index.js +++ b/app/Resources/static/themes/_global/index.js | |||
@@ -34,7 +34,21 @@ $(document).ready(() => { | |||
34 | app.registry.registerUtility(authorization, 'authorizationPolicy'); | 34 | app.registry.registerUtility(authorization, 'authorizationPolicy'); |
35 | 35 | ||
36 | const x = JSON.parse($('#annotationroutes').html()); | 36 | const x = JSON.parse($('#annotationroutes').html()); |
37 | app.include(annotator.storage.http, x); | 37 | app.include(annotator.storage.http, $.extend({}, x, { |
38 | onError(msg, xhr) { | ||
39 | if (!Object.prototype.hasOwnProperty.call(xhr, 'responseJSON')) { | ||
40 | annotator.notification.banner('An error occurred', 'error'); | ||
41 | return; | ||
42 | } | ||
43 | $.each(xhr.responseJSON.children, (k, v) => { | ||
44 | if (v.errors) { | ||
45 | $.each(v.errors, (n, errorText) => { | ||
46 | annotator.notification.banner(errorText, 'error'); | ||
47 | }); | ||
48 | } | ||
49 | }); | ||
50 | }, | ||
51 | })); | ||
38 | 52 | ||
39 | app.start().then(() => { | 53 | app.start().then(() => { |
40 | app.annotations.load({ entry: x.entryId }); | 54 | app.annotations.load({ entry: x.entryId }); |