summaryrefslogtreecommitdiff
path: root/public/assets/javascripts
diff options
context:
space:
mode:
Diffstat (limited to 'public/assets/javascripts')
-rw-r--r--public/assets/javascripts/vendor/ModalFormView.js31
1 files changed, 23 insertions, 8 deletions
diff --git a/public/assets/javascripts/vendor/ModalFormView.js b/public/assets/javascripts/vendor/ModalFormView.js
index 16d63b2..bb926d1 100644
--- a/public/assets/javascripts/vendor/ModalFormView.js
+++ b/public/assets/javascripts/vendor/ModalFormView.js
@@ -1,7 +1,7 @@
var ModalFormView = ModalView.extend({
- method: "put",
+ method: "post",
events: {
"submit form": "submit"
@@ -44,18 +44,33 @@ var ModalFormView = ModalView.extend({
return
}
}
-
- var fields = this.$form.serializeArray()
- fields.forEach(function(pair){
- if (pair.name.indexOf("password") !== -1 && pair.value.length > 0) {
- pair.value = SHA1.hex('lol$' + pair.value + '$vvalls')
+
+ var fd = new FormData()
+
+ this.$("input[name], select[name], textarea[name]").each( function(){
+ if (this.type == "file") {
+ if (this.files.length > 0) {
+ fd.append(this.name, this.files[0]);
+ console.log(this.name)
+ }
}
- })
+ else if (this.type == "password") {
+ if (this.value.length > 0) {
+ fd.append(this.name, SHA1.hex('lol$' + this.value + '$vvalls'))
+ }
+ }
+ else {
+ fd.append(this.name, $(this).val());
+ }
+ });
var request = $.ajax({
url: this.action,
type: this.method,
- data: $.param(fields)
+ data: fd,
+ dataType: "json",
+ processData: false,
+ contentType: false,
});
request.done($.proxy(function (response) {
if (response.error) {