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