diff options
| author | ryderr <r@okfoc.us> | 2014-10-10 16:01:17 -0400 |
|---|---|---|
| committer | ryderr <r@okfoc.us> | 2014-10-10 16:01:17 -0400 |
| commit | 5f70ab0a06df724df61e46a0b66eab4880fbea4d (patch) | |
| tree | 88a6cd42b96daa19c6f57d836edb95d73723b147 /public/assets/javascripts/ui/site/ProfileView.js | |
| parent | 4c39517d0a3cd3b28a9e757cbb40e38f406a93a8 (diff) | |
| parent | 8990307ff8f90007b59cf778d2b3da0372dedf14 (diff) | |
Merge branch 'master' of github.com:okfocus/vvalls
Diffstat (limited to 'public/assets/javascripts/ui/site/ProfileView.js')
| -rw-r--r-- | public/assets/javascripts/ui/site/ProfileView.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/public/assets/javascripts/ui/site/ProfileView.js b/public/assets/javascripts/ui/site/ProfileView.js index 76d733c..8471abc 100644 --- a/public/assets/javascripts/ui/site/ProfileView.js +++ b/public/assets/javascripts/ui/site/ProfileView.js @@ -21,6 +21,25 @@ var ProfileView = View.extend({ }, uploadAvatar: function(){ + var fd = new FormData(), hasCSRF = false + var files = this.$("#profile_avatar")[0].files + if (! files.length) return + + fd.append("avatar", files[0]); + fd.append("_csrf", $("[name=_csrf]").val()) + + var request = $.ajax({ + url: "/api/profile", + type: "put", + data: fd, + dataType: "json", + processData: false, + contentType: false, + }) + + request.done($.proxy(function (response) { + window.location.href = "/profile" + }, this)); } }) |
