summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorRobert Zorko <robertz@gurucue.com>2015-10-15 11:19:25 +0200
committerRobert Zorko <robertz@gurucue.com>2015-10-15 11:19:25 +0200
commit9e75e05583b9ae07e86438c63bcc2dc22be05fea (patch)
tree6ef0bc5c5a17e3f99262d02f58b29e84905215b2 /js
parent751ee468a0f996da42bccc65a9dfee5a7b243352 (diff)
AAI login is moved to its own screen and js file
Diffstat (limited to 'js')
-rw-r--r--js/codeq/aaiLogin.js37
-rw-r--r--js/codeq/login.js26
-rw-r--r--js/codeq/navigation.js2
3 files changed, 55 insertions, 10 deletions
diff --git a/js/codeq/aaiLogin.js b/js/codeq/aaiLogin.js
new file mode 100644
index 0000000..e6e36ab
--- /dev/null
+++ b/js/codeq/aaiLogin.js
@@ -0,0 +1,37 @@
+/**
+ * Created by robert on 10/14/15.
+ */
+(function(){
+
+ var jqNavBarRight = $('.nav.navbar-nav.navbar-right'),
+ jqNavigationHomeBtn = $('#navigation-home'),
+ jqCancelAaiLogin = $("#cancel_aai_login");
+
+ codeq.globalStateMachine.register('aailogin',{
+ 'enter': function(){
+ jqNavigationHomeBtn.off('click');//remove the click listener of this element here
+ jqNavBarRight.css('display','none');//hide settings etc.
+
+ jqCancelAaiLogin.on('click',function(){
+ codeq.globalStateMachine.transition('login');
+ });
+
+ $('#signed-in-title').html('');
+ $('#screen_aai_login').css('display','');
+ },
+ 'exit' : function(){
+ //disable site specific listeners
+ jqCancelAaiLogin.off('click');
+
+ $("#screen_aai_login").css('display', 'none');
+ //re-enable the click listener
+ jqNavigationHomeBtn.on('click', function(e){
+ codeq.globalStateMachine.transition('language');
+ e.preventDefault();
+ });
+ //show the menu buttons
+ jqNavBarRight.css('display','');
+ }
+ });
+
+})();
diff --git a/js/codeq/login.js b/js/codeq/login.js
index 29dd87b..961b708 100644
--- a/js/codeq/login.js
+++ b/js/codeq/login.js
@@ -4,7 +4,10 @@
(function(){
var jqNavBarRight = $('.nav.navbar-nav.navbar-right'),
- jqNavigationHomeBtn = $('#navigation-home');
+ jqNavigationHomeBtn = $('#navigation-home'),
+ jqAAILoginBtn = $('#aai_login_button'),
+ jqSignupBtn = $('#signup_button'),
+ jqSubmitLoginBtn = $("#submit");
var loginFun = function(){
$('#disabled').css('display', '');
@@ -56,15 +59,20 @@
$('#signed-in-title').html('');
//setup the signup button
- $('#signup_button').on('click', function(e){
+ jqSignupBtn.on('click', function(e){
codeq.globalStateMachine.transition('signup');
e.preventDefault();
});
+ //setup the AAI login btn
+ jqAAILoginBtn.on('click',function(e){
+ codeq.globalStateMachine.transition('aailogin');
+ e.preventDefault();
+ });
- $("#submit").on('click', loginFun);
+ jqSubmitLoginBtn.on('click', loginFun);
formInputs.on('keyup', function (ev) {
if ((ev.keyCode || ev.which) == 13) {
- $('#submit').trigger('click');
+ jqSubmitLoginBtn.trigger('click');
}
});
//$('#modalLogIn').modal();
@@ -72,9 +80,12 @@
$('#disabled').css('display', 'none');
},
'exit' : function(){
- $("#submit").off('click', loginFun);
+ //remove the listener from the buttons specific to this page
+ jqSubmitLoginBtn.off('click', loginFun);
formInputs.off('keyup');
- //$('#modalLogIn').modal('hide');
+ jqSignupBtn.off('click');
+ jqAAILoginBtn.off('click');
+
$("#screen_login").css('display', 'none');
$('#signed-in-title').html($('#username').val());
$("#password").val('');
@@ -84,9 +95,6 @@
e.preventDefault();
});
jqNavBarRight.css('display','');
-
- //remove the listener from the signup button
- $('#signup_button').off('click');
}
});
})();
diff --git a/js/codeq/navigation.js b/js/codeq/navigation.js
index 9b7a8f7..5dbbf1e 100644
--- a/js/codeq/navigation.js
+++ b/js/codeq/navigation.js
@@ -71,7 +71,7 @@
},
'actualTransition': function (name) {
//check if we are logged in - if we aren't we will always transition to the login state
- if(!codeq.comms.getSid() && name !== "signup"){//we can of course enter the signup state even if not logged in
+ if(!codeq.comms.getSid() && name !== "signup" && name !== "aailogin"){//we can of course enter the signup/aailogin state even if not logged in
name = 'login';//this will cause the following code to transition to the login state instead of the original one given
}