diff options
Diffstat (limited to 'public/js/controllers')
-rw-r--r-- | public/js/controllers/homeController.js | 67 | ||||
-rw-r--r-- | public/js/controllers/loginController.js | 14 | ||||
-rw-r--r-- | public/js/controllers/signupController.js | 9 |
3 files changed, 0 insertions, 90 deletions
diff --git a/public/js/controllers/homeController.js b/public/js/controllers/homeController.js deleted file mode 100644 index 9894d0e..0000000 --- a/public/js/controllers/homeController.js +++ /dev/null @@ -1,67 +0,0 @@ - -function HomeController() -{ - -// bind event listeners to button clicks // - var that = this; - -// handle user logout // - $('#btn-logout').click(function(){ that.attemptLogout(); }); - -// confirm account deletion // - $('#account-form-btn1').click(function(){$('.modal-confirm').modal('show')}); - -// handle account deletion // - $('.modal-confirm .submit').click(function(){ that.deleteAccount(); }); - - this.deleteAccount = function() - { - $('.modal-confirm').modal('hide'); - var that = this; - $.ajax({ - url: '/delete', - type: 'POST', - data: { id: $('#userId').val()}, - success: function(data){ - that.showLockedAlert('Your account has been deleted.<br>Redirecting you back to the homepage.'); - }, - error: function(jqXHR){ - console.log(jqXHR.responseText+' :: '+jqXHR.statusText); - } - }); - } - - this.attemptLogout = function() - { - var that = this; - $.ajax({ - url: "/home", - type: "POST", - data: {logout : true}, - success: function(data){ - that.showLockedAlert('You are now logged out.<br>Redirecting you back to the homepage.'); - }, - error: function(jqXHR){ - console.log(jqXHR.responseText+' :: '+jqXHR.statusText); - } - }); - } - - this.showLockedAlert = function(msg){ - $('.modal-alert').modal({ show : false, keyboard : false, backdrop : 'static' }); - $('.modal-alert .modal-header h3').text('Success!'); - $('.modal-alert .modal-body p').html(msg); - $('.modal-alert').modal('show'); - $('.modal-alert button').click(function(){window.location.href = '/';}) - setTimeout(function(){window.location.href = '/';}, 3000); - } -} - -HomeController.prototype.onUpdateSuccess = function() -{ - $('.modal-alert').modal({ show : false, keyboard : true, backdrop : true }); - $('.modal-alert .modal-header h3').text('Success!'); - $('.modal-alert .modal-body p').html('Your account has been updated.'); - $('.modal-alert').modal('show'); - $('.modal-alert button').off('click'); -} diff --git a/public/js/controllers/loginController.js b/public/js/controllers/loginController.js deleted file mode 100644 index a894aed..0000000 --- a/public/js/controllers/loginController.js +++ /dev/null @@ -1,14 +0,0 @@ - -function LoginController() -{ - -// bind event listeners to button clicks // - - $('#login-form #forgot-password').click(function(){ $('#get-credentials').modal('show');}); - -// automatically toggle focus between the email modal window and the login form // - - $('#get-credentials').on('shown', function(){ $('#email-tf').focus(); }); - $('#get-credentials').on('hidden', function(){ $('#user-tf').focus(); }); - -}
\ No newline at end of file diff --git a/public/js/controllers/signupController.js b/public/js/controllers/signupController.js deleted file mode 100644 index 97d20e6..0000000 --- a/public/js/controllers/signupController.js +++ /dev/null @@ -1,9 +0,0 @@ - -function SignupController() -{ -// redirect to homepage when cancel button is clicked // - $('#account-form-btn1').click(function(){ window.location.href = '/';}); - -// redirect to homepage on new account creation, add short delay so user can read alert window // - $('.modal-alert #ok').click(function(){ setTimeout(function(){window.location.href = '/';}, 300)}); -}
\ No newline at end of file |