diff options
Diffstat (limited to 'public/assets')
| -rw-r--r-- | public/assets/javascripts/ui/site/ProfileView.js | 19 | ||||
| -rwxr-xr-x | public/assets/stylesheets/app.css | 1 |
2 files changed, 20 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)); } }) diff --git a/public/assets/stylesheets/app.css b/public/assets/stylesheets/app.css index 57cb8fc..29f7888 100755 --- a/public/assets/stylesheets/app.css +++ b/public/assets/stylesheets/app.css @@ -679,6 +679,7 @@ iframe.embed { } .profilepage .about h2 .btn { + float: none; border: 1px solid; font-weight: 500; padding: 10px; |
