Do not redirect when newsletter is invalid

This commit is contained in:
Tautvidas Sipavičius
2015-10-01 14:34:53 +03:00
parent 39b2a2ad40
commit 671befbfd8

View File

@@ -67,7 +67,8 @@ define([
initialize: function(options) { initialize: function(options) {
App.getChannel().on('beforeEditorSave', this.beforeSave, this); App.getChannel().on('beforeEditorSave', this.beforeSave, this);
App.getChannel().on('afterEditorSave', this.afterSave, this); App.getChannel().on('afterEditorSave', this.afterSave, this);
},
onRender: function() {
this.validateNewsletter(App.toJSON()); this.validateNewsletter(App.toJSON());
}, },
save: function() { save: function() {
@@ -126,8 +127,10 @@ define([
}, },
next: function() { next: function() {
this.hideOptionContents(); this.hideOptionContents();
console.log('Next'); if(!this.$('.mailpoet_save_next').hasClass('button-disabled')) {
window.location.href = App.getConfig().get('urls.send'); console.log('Next');
window.location.href = App.getConfig().get('urls.send');
}
}, },
validateNewsletter: function(jsonObject) { validateNewsletter: function(jsonObject) {
if (!App._contentContainer.isValid()) { if (!App._contentContainer.isValid()) {