diff --git a/packages/telescope-comments/lib/client/templates/comment_submit.js b/packages/telescope-comments/lib/client/templates/comment_submit.js index d849cc747..693129942 100644 --- a/packages/telescope-comments/lib/client/templates/comment_submit.js +++ b/packages/telescope-comments/lib/client/templates/comment_submit.js @@ -16,6 +16,8 @@ AutoForm.hooks({ var comment = doc; this.template.$('button[type=submit]').addClass('loading'); + this.template.$('input, textarea').not(":disabled").addClass("disabled").prop("disabled", true); + var parent = this.formAttributes.parentContext; if (!!parent.comment) { // child comment @@ -51,6 +53,8 @@ AutoForm.hooks({ onSuccess: function(operation, comment) { this.template.$('button[type=submit]').removeClass('loading'); + this.template.$('.disabled').removeClass("disabled").prop("disabled", false); + Events.track("new comment", {'commentId': comment._id}); FlowRouter.go('postPage', {_id: comment.postId}); if (comment.status === Posts.config.STATUS_PENDING) { @@ -60,6 +64,8 @@ AutoForm.hooks({ onError: function(operation, error) { this.template.$('button[type=submit]').removeClass('loading'); + this.template.$('.disabled').removeClass("disabled").prop("disabled", false); + Messages.flash(error.message.split('|')[0], 'error'); // workaround because error.details returns undefined Messages.clearSeen(); } diff --git a/packages/telescope-posts/lib/client/templates/post_submit.js b/packages/telescope-posts/lib/client/templates/post_submit.js index 97312d049..65433f782 100644 --- a/packages/telescope-posts/lib/client/templates/post_submit.js +++ b/packages/telescope-posts/lib/client/templates/post_submit.js @@ -17,7 +17,7 @@ AutoForm.hooks({ var post = doc; this.template.$('button[type=submit]').addClass('loading'); - this.template.$('input').not(":disabled").addClass("disabled").prop("disabled", true); + this.template.$('input, textarea').not(":disabled").addClass("disabled").prop("disabled", true); // ------------------------------ Checks ------------------------------ // @@ -46,7 +46,7 @@ AutoForm.hooks({ onError: function(operation, error) { this.template.$('button[type=submit]').removeClass('loading'); - this.template.$('input.disabled').removeClass("disabled").prop("disabled", false); + this.template.$('.disabled').removeClass("disabled").prop("disabled", false); Messages.flash(error.message.split('|')[0], 'error'); // workaround because error.details returns undefined Messages.clearSeen();