summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/ui/EditProfileModal.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2014-06-10 12:00:24 -0400
committerJules Laplace <jules@okfoc.us>2014-06-10 12:00:24 -0400
commit9fb0fe9b7ef614d2248b00ea2b964205f3453f41 (patch)
tree953fd956e1c6b3d641226d7ac36cc749ced92504 /public/assets/javascripts/ui/EditProfileModal.js
parent3f8e4223cc57bc3fd461881e3d6e9eb331bf4dc5 (diff)
split up builder functionality
Diffstat (limited to 'public/assets/javascripts/ui/EditProfileModal.js')
-rw-r--r--public/assets/javascripts/ui/EditProfileModal.js56
1 files changed, 0 insertions, 56 deletions
diff --git a/public/assets/javascripts/ui/EditProfileModal.js b/public/assets/javascripts/ui/EditProfileModal.js
deleted file mode 100644
index 6b89ad8..0000000
--- a/public/assets/javascripts/ui/EditProfileModal.js
+++ /dev/null
@@ -1,56 +0,0 @@
-
-var EditProfileModal = ModalFormView.extend({
- el: ".mediaDrawer.editProfile",
- action: "/api/profile",
- method: "put",
-
- load: function(){
- this.reset()
- $.get("/api/profile", $.proxy(function(data){
- console.log(data)
-
- for (var i in data) {
- this.$("[name='" + i + "']").val(data[i])
- }
-
- this.$("#profile_username").html(data.username)
-
- if (data.photo && data.photo.length) {
- this.$("#load_avatar").attr("src", data.photo)
- }
- else {
- this.$("#load_avatar").hide()
- }
-
- this.show()
- }, this))
- },
-
- validate: function(){
- var errors = []
-
- var email = this.$("#profile_email").val()
- var pw0 = this.$("#profile_old_password").val()
- var pw1 = this.$("#profile_new_password").val()
- var pw2 = this.$("#profile_new_password2").val()
-
- if (pw1.length) {
- if (! pw0.length) {
- errors.push("Please enter your old password.")
- }
- if (pw1 !== pw2) {
- errors.push("New passwords don't match");
- }
- }
- if (email.length && email.indexOf("@") === -1) {
- errors.push("Please enter a valid email address");
- }
-
- return errors
- },
-
- success: function(){
- window.location.href = "/profile"
- }
-
-})