##// END OF EJS Templates
comments: added better alerts for failed commenting operations.
marcink -
r4311:a06710aa default
parent child Browse files
Show More
@@ -347,11 +347,10 b' var _submitAjaxPOST = function(url, post'
347 347 self.globalSubmitSuccessCallback();
348 348
349 349 };
350 var submitFailCallback = function(data) {
351 alert(
352 "Error while submitting comment.\n" +
353 "Error code {0} ({1}).".format(data.status, data.statusText)
354 );
350 var submitFailCallback = function(jqXHR, textStatus, errorThrown) {
351 var prefix = "Error while submitting comment.\n"
352 var message = formatErrorMessage(jqXHR, textStatus, errorThrown, prefix);
353 ajaxErrorSwal(message);
355 354 self.resetCommentFormState(text);
356 355 };
357 356 self.submitAjaxPOST(
@@ -447,11 +446,11 b' var _submitAjaxPOST = function(url, post'
447 446 $(self.previewContainer).show();
448 447
449 448 // by default we reset state of comment preserving the text
450 var previewFailCallback = function(data){
451 alert(
452 "Error while preview of comment.\n" +
453 "Error code {0} ({1}).".format(data.status, data.statusText)
454 );
449 var previewFailCallback = function(jqXHR, textStatus, errorThrown) {
450 var prefix = "Error while preview of comment.\n"
451 var message = formatErrorMessage(jqXHR, textStatus, errorThrown, prefix);
452 ajaxErrorSwal(message);
453
455 454 self.resetCommentFormState(text)
456 455 };
457 456 self.submitAjaxPOST(
@@ -576,8 +575,11 b' var CommentsController = function() {'
576 575 $comment.remove();
577 576 return false;
578 577 };
579 var failure = function(data, textStatus, xhr) {
580 alert("error processing request: " + textStatus);
578 var failure = function(jqXHR, textStatus, errorThrown) {
579 var prefix = "Error while deleting this comment.\n"
580 var message = formatErrorMessage(jqXHR, textStatus, errorThrown, prefix);
581 ajaxErrorSwal(message);
582
581 583 $comment.show('fast');
582 584 $comment.removeClass('comment-deleting');
583 585 return false;
@@ -879,11 +881,10 b' var CommentsController = function() {'
879 881 commentForm.setActionButtonsDisabled(false);
880 882
881 883 };
882 var submitFailCallback = function(data){
883 alert(
884 "Error while submitting comment.\n" +
885 "Error code {0} ({1}).".format(data.status, data.statusText)
886 );
884 var submitFailCallback = function(jqXHR, textStatus, errorThrown) {
885 var prefix = "Error while submitting comment.\n"
886 var message = formatErrorMessage(jqXHR, textStatus, errorThrown, prefix);
887 ajaxErrorSwal(message);
887 888 commentForm.resetCommentFormState(text)
888 889 };
889 890 commentForm.submitAjaxPOST(
General Comments 0
You need to be logged in to leave comments. Login now