summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Zorko <robertz@gurucue.com>2015-09-29 15:29:42 +0200
committerRobert Zorko <robertz@gurucue.com>2015-09-29 15:29:42 +0200
commita565a09172071783174450cea5a425964f3b6aa6 (patch)
tree2a05a549c64b9a84e5f7bb98b04f8ca616807d26
parent1e0c68482267f7e7393d2cde5042fcd863b8e23b (diff)
added settings to the global codeq object and they are updated when the user logs into the application
-rw-r--r--js/codeq/core.js2
-rw-r--r--js/codeq/login.js8
2 files changed, 10 insertions, 0 deletions
diff --git a/js/codeq/core.js b/js/codeq/core.js
index 1685dd7..ef3648f 100644
--- a/js/codeq/core.js
+++ b/js/codeq/core.js
@@ -199,6 +199,8 @@
'log': log,
+ 'settings':{},
+
'availableLangs': [], // filled at boot from 'supportedLangs'
'supportedLangs': {
'en': 'English',
diff --git a/js/codeq/login.js b/js/codeq/login.js
index bb92325..02a6517 100644
--- a/js/codeq/login.js
+++ b/js/codeq/login.js
@@ -14,6 +14,14 @@
$('#disabled').css('display', 'none');
$('#disabled').css('cursor', '');
if (data.code !== 0) throw new Error('Login failed, code: ' + data.code + ', message: ' + data.message);
+
+ //merge these settings into the already existing default settings
+ sett = data.settings;
+ $.merge(true, codeq.settings, sett);
+ if('lang' in sett && sett['lan'] in codeq.supportedLangs){
+ codeq.setLang(sett['lan']);
+ }
+
codeq.globalStateMachine.transition('language');
//codeq.activateState('language');
})