aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/public/js/views/home.js
diff options
context:
space:
mode:
authorDennis Eriksen <dennis.se@gmail.com>2013-03-20 12:43:33 +0100
committerDennis Eriksen <dennis.se@gmail.com>2013-03-20 12:43:33 +0100
commit266767e6b31d4799b218a7dc9ffd0d6f2eca92a8 (patch)
treee3e68b3acdfb276cadcc23d0028a6c1dd3bc8f21 /public/js/views/home.js
parentEdited "Sign in" button - for fun (diff)
downloadDivid-266767e6b31d4799b218a7dc9ffd0d6f2eca92a8.tar.gz
login screen
Diffstat (limited to 'public/js/views/home.js')
-rw-r--r--public/js/views/home.js49
1 files changed, 49 insertions, 0 deletions
diff --git a/public/js/views/home.js b/public/js/views/home.js
new file mode 100644
index 0000000..eda246a
--- /dev/null
+++ b/public/js/views/home.js
@@ -0,0 +1,49 @@
+
+$(document).ready(function(){
+
+ var hc = new HomeController();
+ var av = new AccountValidator();
+
+ $('#account-form').ajaxForm({
+ beforeSubmit : function(formData, jqForm, options){
+ if (av.validateForm() == false){
+ return false;
+ } else{
+ // push the disabled username field onto the form data array //
+ formData.push({name:'user', value:$('#user-tf').val()})
+ return true;
+ }
+ },
+ success : function(responseText, status, xhr, $form){
+ if (status == 'success') hc.onUpdateSuccess();
+ },
+ error : function(e){
+ if (e.responseText == 'email-taken'){
+ av.showInvalidEmail();
+ } else if (e.responseText == 'username-taken'){
+ av.showInvalidUserName();
+ }
+ }
+ });
+ $('#name-tf').focus();
+ $('#github-banner').css('top', '41px');
+
+// customize the account settings form //
+
+ $('#account-form h1').text('Account Settings');
+ $('#account-form #sub1').text('Here are the current settings for your account.');
+ $('#user-tf').attr('disabled', 'disabled');
+ $('#account-form-btn1').html('Delete');
+ $('#account-form-btn1').addClass('btn-danger');
+ $('#account-form-btn2').html('Update');
+
+// setup the confirm window that displays when the user chooses to delete their account //
+
+ $('.modal-confirm').modal({ show : false, keyboard : true, backdrop : true });
+ $('.modal-confirm .modal-header h3').text('Delete Account');
+ $('.modal-confirm .modal-body p').html('Are you sure you want to delete your account?');
+ $('.modal-confirm .cancel').html('Cancel');
+ $('.modal-confirm .submit').html('Delete');
+ $('.modal-confirm .submit').addClass('btn-danger');
+
+}) \ No newline at end of file