diff options
| author | Jules Laplace <jules@okfoc.us> | 2014-06-09 11:26:04 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2014-06-09 11:26:04 -0400 |
| commit | e5dc46846ce9fb1c990d291ef852c0cad3f74957 (patch) | |
| tree | 16de7362bcdb8d87e41f22f452f6b8e427e98ff1 /public/assets/javascripts/ui/ModalFormView.js | |
| parent | e8ba718205d41e75923264ef945178030b662c93 (diff) | |
editing profile
Diffstat (limited to 'public/assets/javascripts/ui/ModalFormView.js')
| -rw-r--r-- | public/assets/javascripts/ui/ModalFormView.js | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/public/assets/javascripts/ui/ModalFormView.js b/public/assets/javascripts/ui/ModalFormView.js deleted file mode 100644 index 608b8c1..0000000 --- a/public/assets/javascripts/ui/ModalFormView.js +++ /dev/null @@ -1,70 +0,0 @@ - -var ModalFormView = ModalView.extend({ - - events: { - "submit form": "submit" - }, - - initialize: function(){ - this.$form = this.$("form") - this.$errors = this.$(".errors") - this.$errorList = this.$(".errorList") - }, - - reset: function(){ - this.$("input").not("[type='submit']").not("[type='hidden']").val("") - }, - - load: function(){ - this.reset() - this.show() - }, - - showErrors: function(errors){ - if (errors && errors.length) { - this.$errors.show(); - for (var i in errors) { - this.$errorList.append('<div>' + errors[i] + '</div>'); - } - } - }, - - submit: function(e){ - e.preventDefault() - - this.$errors.hide(); - this.$errorList.empty(); - - if (this.validate) { - var errors = this.validate() - if (errors && errors.length) { - this.showErrors(errors) - return - } - } - - var fields = this.$form.serializeArray() - fields.forEach(function(pair){ - if (pair.name == "password" && pair.value.length > 0) { - pair.value = SHA1.hex('lol$' + pair.value + '$vvalls') - } - }) - - var request = $.post(this.action, $.param(fields)); - request.done($.proxy(function (response) { - if (response.error) { - this.$errors.show(); - var errors = [] - for (var key in response.error.errors) { - errors.push(response.error.errors[key].message); - } - this.showErrors(errors) - return - } - else { - this.success && this.success(response) - } - }, this)); - } - -}) |
