mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 10:01:40 -05:00
disable form inputs on post and comment submit
This commit is contained in:
parent
0254d13a4b
commit
b192c2a74b
2 changed files with 8 additions and 2 deletions
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Add table
Reference in a new issue