summaryrefslogtreecommitdiff
path: root/StoneIsland/www/js/vendor/view/serializable.js
diff options
context:
space:
mode:
Diffstat (limited to 'StoneIsland/www/js/vendor/view/serializable.js')
-rw-r--r--StoneIsland/www/js/vendor/view/serializable.js17
1 files changed, 14 insertions, 3 deletions
diff --git a/StoneIsland/www/js/vendor/view/serializable.js b/StoneIsland/www/js/vendor/view/serializable.js
index 4ad5558f..ae742d75 100644
--- a/StoneIsland/www/js/vendor/view/serializable.js
+++ b/StoneIsland/www/js/vendor/view/serializable.js
@@ -15,12 +15,16 @@ var SerializableView = View.extend({
})
},
- validate: function(data){
+ validate: function(errors){
+ var data = this.serialize()
var errors = []
var presence_msgs = this.validate_presence
Object.keys(presence_msgs).forEach(function(k){
if (! data[k]) errors.push( [ k, presence_msgs[k] ] )
})
+ this.validate_fields && this.validate_fields(errors)
+ this.cc && this.cc.validate(errors)
+ this.address && this.address.validate(errors)
return errors.length ? errors : null
},
@@ -50,10 +54,17 @@ var SerializableView = View.extend({
this.hide_errors()
}
+ // app.curtain.show()
this.action({
data: data,
- success: this.success.bind(this),
- error: this.error.bind(this),
+ success: function(data){
+ // app.curtain.hide()
+ this.success(data)
+ }.bind(this),
+ error: function(data){
+ // app.curtain.hide()
+ this.error(data)
+ }.bind(this),
})
},