summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--index.html61
-rw-r--r--js/codeq/login.js15
-rw-r--r--js/codeq/navigation.js5
3 files changed, 68 insertions, 13 deletions
diff --git a/index.html b/index.html
index ec2c5dc..57b60b9 100644
--- a/index.html
+++ b/index.html
@@ -127,7 +127,54 @@
</div>
</form>
</div-->
-
+<!--TODO -->
+ <!-- login screen -->
+ <div class="container" id="screen_login" style="display: none;">
+ <div class="modal-dialog modal-sm">
+ <!--div class="modal-content"-->
+ <div class="row"><!--class="modal-header"-->
+ <h3 class="text-center">Please sign in</h3>
+ </div>
+ <div class="row"><!--class="modal-body"-->
+ <div class="row">
+ <div class="col-md-12">
+ Login via
+ <div class="ssa-buttons">
+ <a href="#" class="ssa-buttons" role="button" data-dismiss="modal" data-toggle="modal" data-target="#modalAAI">
+ <img src="res/gumb_aaiprijava.png" style="width: 49%">
+ </a>
+ </div>
+ or
+ <form class="form" role="form" method="post" action="login" accept-charset="UTF-8" id="login-nav">
+ <div class="form-group">
+ <label class="sr-only" for="username">Username</label>
+ <input type="text" class="form-control" id="username" placeholder="Username" required>
+ </div>
+ <div class="form-group">
+ <label class="sr-only" for="password">Password</label>
+ <input type="password" class="form-control" id="password" placeholder="Password" required>
+ <!--div class="help-block text-right"><a href="#">Forgot the password?</a></div-->
+ </div>
+ <div class="form-group">
+ <button class="btn btn-primary btn-block" type="button" id="submit">Sign in</button>
+ </div>
+ <!--div class="checkbox">
+ <label>
+ <input type="checkbox"> keep me logged-in
+ </label>
+ </div-->
+ </form>
+ </div>
+ </div>
+ </div><!--/modal-body-->
+ <div class="row"><!-- class="modal-footer"-->
+ <div class="text-center">
+ New here ? <a href="#" role="button" data-dismiss="modal" data-toggle="modal" data-target="#modalSignUp"><b>Sign Up</b></a>
+ </div>
+ </div><!--/modal-footer-->
+ <!--/div-->
+ </div>
+ </div>
<!-- main screen: programming language selection, settings, etc. -->
<div class="container" id="screen_language" style="text-align: center; display: none;">
@@ -303,7 +350,7 @@
<!-- Modals -->
- <div id="modalLogIn" class="modal fade in" tabindex="-1" role="dialog" aria-hidden="false" data-keyboard="false" data-backdrop="static" style="display: none;">
+ <!--<div id="modalLogIn" class="modal fade in" tabindex="-1" role="dialog" aria-hidden="false" data-keyboard="false" data-backdrop="static" style="display: none;">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
@@ -327,7 +374,7 @@
<div class="form-group">
<label class="sr-only" for="password">Password</label>
<input type="password" class="form-control" id="password" placeholder="Password" required>
- <!--div class="help-block text-right"><a href="#">Forgot the password?</a></div-->
+ <!--div class="help-block text-right"><a href="#">Forgot the password?</a></div->
</div>
<div class="form-group">
<button class="btn btn-primary btn-block" type="button" id="submit">Sign in</button>
@@ -336,19 +383,19 @@
<label>
<input type="checkbox"> keep me logged-in
</label>
- </div-->
+ </div->
</form>
</div>
</div>
- </div><!--/modal-body-->
+ </div><!--/modal-body->
<div class="modal-footer">
<div class="text-center">
New here ? <a href="#" role="button" data-dismiss="modal" data-toggle="modal" data-target="#modalSignUp"><b>Sign Up</b></a>
</div>
- </div><!--/modal-footer-->
+ </div><!--/modal-footer->
</div>
</div>
- </div>
+ </div>-->
<div id="modalSignUp" class="modal fade in" tabindex="-1" role="dialog" aria-hidden="false" data-keyboard="false" data-backdrop="static" style="display: none;">
diff --git a/js/codeq/login.js b/js/codeq/login.js
index 114381c..a33eb20 100644
--- a/js/codeq/login.js
+++ b/js/codeq/login.js
@@ -48,6 +48,7 @@
codeq.globalStateMachine.register('login',{
'enter': function(){
+ $('#navigation-home').off('click');//remove the click listener of this element here only - in each other state the listener should exist
$('#signed-in-title').html('');
$("#submit").on('click', loginFun);
formInputs.on('keyup', function (ev) {
@@ -55,16 +56,22 @@
$('#submit').trigger('click');
}
});
- $('#modalLogIn').modal();
- //$("#screen_login").css('display', '');
+ //$('#modalLogIn').modal();
+ $("#screen_login").css('display', '');
$('#disabled').css('display', 'none');
},
'exit' : function(){
$("#submit").off('click', loginFun);
formInputs.off('keyup');
- $('#modalLogIn').modal('hide');
- //$("#screen_login").css('display', 'none');
+ //$('#modalLogIn').modal('hide');
+ $("#screen_login").css('display', 'none');
+ $('#signed-in-title').html('Signed in as '+$('#username').val());
$("#password").val('');
+ //re-enable the click listener
+ $('#navigation-home').on('click', function(e){
+ codeq.globalStateMachine.transition('language');
+ e.preventDefault();
+ });
}
});
})();
diff --git a/js/codeq/navigation.js b/js/codeq/navigation.js
index eafa5cc..af1d250 100644
--- a/js/codeq/navigation.js
+++ b/js/codeq/navigation.js
@@ -105,14 +105,15 @@
codeq.comms.logout()
.then(function (data) {
console.log(data);
- //codeq.globalStateMachine.transition('login');
+ codeq.comms.disconnect();
+ codeq.globalStateMachine.transition('login');
})
.fail(function (reason) {
console.log(reason);
})
.done();
- codeq.globalStateMachine.transition('login');
+ //codeq.globalStateMachine.transition('login');
e.preventDefault();//prevent this since we'll trigger a page reload otherwise
});
$('#navigation-profile').on('click', function(e){