Commit 93559b1f authored by Bob Hageman's avatar Bob Hageman

fixed onappload, onpageload and onappunload triggerable eevents. little bit of...

fixed onappload, onpageload and onappunload triggerable eevents. little bit of cleanup and other minor fixes
parent 6a26ec23
This diff is collapsed.
......@@ -3,25 +3,24 @@ views = require('./views.js');
module.exports = {
getRoutes: function () {
var arr = [
return [
['get', '#/', views.others.home],
['get', '#/welcome', views.others.welcome],
['get', '#/our-promise', views.others.ourpromise],
['get', '#/terms', views.others.terms],
['get', '#/register', views.register.getregister],
['post', '#/register', views.register.postregister],
['post','#/register', views.register.postregister],
['get', '#/login', views.auth.getlogin],
['post', '#/login', views.auth.postlogin],
['post','#/login', views.auth.postlogin],
['get', '#/logout', views.auth.getlogout],
['get', '#/request/:id', views.request.getarequest],
['get', '#/returnrequest/:id/:payload', views.request.getreturnrequest],
['get', '#/completerequest/:id', views.request.getacompleterequest],
['get', '#/completerequest/:id', views.request.getcompleterequest],
['get', '#/request_done/:id', views.request.getrequestdone],
['get', '#/connect/:token/:settingsuri/:scope', views.connect.getconnect],
['get', '#/shares', views.request.getshares],
['get', '#/idin/tip', views.idin.getidin_tip],
['get','#/idin/select-bank', views.idin.getidin_select_bank]
['get', '#/idin/select-bank', views.idin.getidin_select_bank]
];
return arr;
},
}
......@@ -2,64 +2,63 @@ global.entity = require('../entity.js');
global.tools = require('../tools.js');
module.exports = {
// shows pincode login view.
// if type=firsttime display a custom text header
getlogin : function(e) {
//if
//console.log(url.searchParams.get("firsttime"));
this.title('Inloggen');
// shows pincode login view.
// if type=firsttime display a custom text header
getlogin : function(e) {
//if
//console.log(url.searchParams.get("firsttime"));
this.title('Inloggen');
tools.setTheme('pink');
tools.setLayout('wizard');
e.partial('views/login.tpl', null, function(t){
tools.setTheme('pink');
tools.setLayout('wizard');
// when first login, custom header
if (tools.onetimemessage.get('firsttimelogin') === true)
$('#loginTitle').text('Hoera! Je bent nu een echte Schlussie.');
e.partial('views/login.tpl', null, function(t){
// when first login, custom header
if (tools.onetimemessage.get('firsttimelogin') === true)
$('#loginTitle').text('Hoera! Je bent nu een echte Schlussie.');
var pinInstance = $('#pinwrapper').pinlogin({
placeholder : '*',
complete : function(pin){
var pinInstance = $('#pinwrapper').pinlogin({
placeholder : '*',
complete : function(pin){
$('#pin').val(pin);
$('#loginForm').submit();
}
});
$('#pin').val(pin);
$('#loginForm').submit();
}
});
},
postlogin : function(e){
entity.login(e.params['pin'], function(result){
if (result){
e.onAppLoad(e); // trigger app loaded event manually
e.redirect('#/');
}
else {
// todo, make nice flash message
alert ('Ongeldige pincode, probeer het opnieuw');
}
});
},
});
},
postlogin : function(e){
getlogout : function(e) {
// logout user
entity.logout(function(){
// run unload tasks
onAppUnload(e);
// redirect back
entity.login(e.params['pin'], function(result){
if (result){
e.trigger('onAppLoad', e); // trigger app loaded event manually
e.redirect('#/');
});
}
}
else {
// todo, make nice flash message
alert ('Ongeldige pincode, probeer het opnieuw');
}
});
},
}
getlogout : function(e) {
// logout user
entity.logout(function(){
// run unload tasks
e.trigger('onAppUnload');
// redirect back
e.redirect('#/');
});
}
}
\ No newline at end of file
......@@ -34,7 +34,7 @@ module.exports = {
stateUrl = stateUrl.replace('[state]', encodeURIComponent('connecting'));
// update client api to 'connecting'
app.trigger('connection-update-clientapi', { token: e.params['token'], apiuri: stateUrl });
e.trigger('connection-update-clientapi', { token: e.params['token'], apiuri: stateUrl });
// screen wait helper: get the resttime
var restTime = tools.timer.calculate(3000);
......
......@@ -127,6 +127,7 @@ module.exports = {
// submit the form
//document.getElementById('processForm').submit();
e.redirect('#/completerequest/' + e.params['id']);
}
// End logic for longpress button
......@@ -266,7 +267,7 @@ module.exports = {
});
},
getrequestdone: function (e) {
getrequestdone : function (e) {
// delete open request
//context.removeItem('requests', e.params['id']);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment