summaryrefslogtreecommitdiff
path: root/js/codeq
diff options
context:
space:
mode:
authorRobert Zorko <robertz@gurucue.com>2015-09-29 18:13:13 +0200
committerRobert Zorko <robertz@gurucue.com>2015-09-29 18:13:13 +0200
commit41412acda7dbc4f13a892455e3f287427639dffb (patch)
tree39901615e10083c66e806608b3d8d09fc6f66547 /js/codeq
parentba7f477d4dcc155132d69d8faefc33523a0089fd (diff)
added the basic cahnge language handler and the support to send an 'settings' action
Diffstat (limited to 'js/codeq')
-rw-r--r--js/codeq/comms.js4
-rw-r--r--js/codeq/settings.js18
2 files changed, 22 insertions, 0 deletions
diff --git a/js/codeq/comms.js b/js/codeq/comms.js
index 5ac3d66..ecca6ff 100644
--- a/js/codeq/comms.js
+++ b/js/codeq/comms.js
@@ -301,6 +301,10 @@
return this.connect().then(performLogin);
},
+ 'updateSettings': function (new_settings){
+ return this.send({'action': 'settings', 'sid': sid, 'settings': new_settings});
+ },
+
sendActivity: function commsSendActivity (trace, solution, problem_id) {
return this.send({'action': 'activity', 'trace': trace, 'solution': solution, 'problem_id': problem_id});
},
diff --git a/js/codeq/settings.js b/js/codeq/settings.js
new file mode 100644
index 0000000..73bef14
--- /dev/null
+++ b/js/codeq/settings.js
@@ -0,0 +1,18 @@
+/**
+ * Created by robert on 9/29/15.
+ */
+(function(){
+ $("#gui_lang_select").on("change",function() {
+ var lang = $("#gui_lang_select").val();
+ if (lang in codeq.supportedLangs) {
+ codeq.log.debug("Changing lang to:" + lang);
+ codeq.comms.updateSettings({'lang': lang})
+ .then(function (data) {
+ if (data.code !== 0) throw new Error('Change language failed, code: ' + data.code + ', message: ' + data.message);
+ codeq.log.debug("success with settings");
+ codeq.setLang(lang);
+ })
+ .done();
+ }
+ })
+})(); \ No newline at end of file