aboutsummaryrefslogtreecommitdiffstats
path: root/static/js/profile.coffee
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2017-01-15 18:24:09 -0800
committerAdam Soltys <[email protected]>2017-01-15 18:24:09 -0800
commit7762ceaa7e2bb34f8758e17a4c8f512fa6a81b9e (patch)
tree91bb1d1b8fe6ad77a48f0e429d9bfd35834c78d9 /static/js/profile.coffee
parent0ae266bf88f9f79c7e99b272688126898303daa4 (diff)
downloadcoinos-server-7762ceaa7e2bb34f8758e17a4c8f512fa6a81b9e.tar.gz
coinos-server-7762ceaa7e2bb34f8758e17a4c8f512fa6a81b9e.zip
Initial Vueification
Diffstat (limited to 'static/js/profile.coffee')
-rw-r--r--static/js/profile.coffee30
1 files changed, 30 insertions, 0 deletions
diff --git a/static/js/profile.coffee b/static/js/profile.coffee
new file mode 100644
index 00000000..a894f275
--- /dev/null
+++ b/static/js/profile.coffee
@@ -0,0 +1,30 @@
+g = exports ? this
+g.proceed = false
+
+$(->
+ $('[data-toggle=popover]').popover()
+ $('#title').focus()
+
+ user = $('#username').val()
+ $.getJSON("/#{user}.json", (data) ->
+ $('#email').val(data.email)
+ $('#phone').val(data.phone)
+ $('#profile').fadeIn()
+ )
+
+ $('#confirm').blur(->
+ $('#confirm_error').remove()
+ if $('#password').val() != $('#confirm').val()
+ $('#password, #confirm').parent().addClass('has-error')
+ $('#confirm').parent().after('<div id="confirm_error" class="alert alert-danger">Passwords don\'t match</div>')
+ else
+ $('#password, #confirm').parent().removeClass('has-error')
+ )
+
+ $('#profile').submit(->
+ $('#profile .form-control').blur()
+ if $('#profile .has-error').length > 0
+ $('#profile .has-error').effect('shake', 500)
+ return false
+ )
+)