Skip to content

Commit 47be68c

Browse files
committed
show alert if actions with suppressed dialog are producing errors
1 parent 11c5cd6 commit 47be68c

File tree

1 file changed

+11
-3
lines changed
  • stage/package/src/main/content/jcr_root/libs/composum/pages/stage/edit/js

1 file changed

+11
-3
lines changed

stage/package/src/main/content/jcr_root/libs/composum/pages/stage/edit/js/dialogs.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -920,14 +920,20 @@
920920
// abstract: return the concrete servlet action selector
921921
},
922922

923-
doSubmit: function () {
923+
doSubmit: function (ignoredOnSuccess, onError) {
924924
var u = dialogs.const.edit.url.version;
925925
var data = this.getActionData();
926926
core.ajaxPost(u.base + this.submitActionKey(), data, {},
927927
_.bind(function (result) {
928928
this.triggerStateChange(data);
929929
this.hide();
930-
}, this), _.bind(this.onError, this));
930+
}, this), _.bind(function (xhr) {
931+
if (_.isFunction(onError)) {
932+
onError(xhr);
933+
} else {
934+
this.onError(xhr);
935+
}
936+
}, this));
931937
},
932938

933939
/**
@@ -988,7 +994,9 @@
988994
dialogs.ElementDialog.prototype.show.apply(this);
989995
} else {
990996
// the show() is suppressed if no unresolved references found
991-
this.doSubmit();
997+
this.doSubmit(undefined, _.bind(function (xhr) {
998+
core.alert(xhr);
999+
}, this));
9921000
this.onClose();
9931001
}
9941002
}

0 commit comments

Comments
 (0)