From 298ab560e8c599dfaf4829eb1426c6642a823122 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Tue, 13 Oct 2015 12:03:10 +0200 Subject: Store robot's address in settings --- index.html | 5 +++++ js/codeq/login.js | 1 + js/codeq/robot.js | 3 +-- js/codeq/settings.js | 36 ++++++++++++++++++++++-------------- res/en.json | 1 + res/sl.json | 1 + 6 files changed, 31 insertions(+), 16 deletions(-) diff --git a/index.html b/index.html index bd861d8..62c9d41 100644 --- a/index.html +++ b/index.html @@ -74,6 +74,11 @@ +
+ Robot’s address +
+ +
  • ' + lang + '
  • '); - jqMenu.find('.' + cssClass).on('click', (function (l) {return function () {codeq.setLang(l)};})(lang)); - } - })(); - - codeq.on('langchange', function (params) { - jqLangChoice.text(params.lang); - }); - - codeq.statusbar = { - - }; -})(); \ No newline at end of file -- cgit v1.2.1 From a2275a04ac07e22790a31e128e3df4473d4afc26 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Tue, 13 Oct 2015 14:20:38 +0200 Subject: Remove codeq.getLang function --- js/codeq/core.js | 4 ---- js/codeq/hint.js | 2 +- js/codeq/settings.js | 2 +- js/codeq/translation.js | 4 ++-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/js/codeq/core.js b/js/codeq/core.js index 6b76042..0976ecc 100644 --- a/js/codeq/core.js +++ b/js/codeq/core.js @@ -395,10 +395,6 @@ 'sl': 'Slovenščina' }, 'isWebApp': false, // this is a PhoneGap/Cordova build, will be overridden in cordova.js for webapp - 'getLang': function () { - return codeq.settings['gui_lang']; - }, - 'setLang': function (newLang) { codeq.settings['gui_lang'] = newLang; codeq.fire('langchange', {'lang': newLang}); diff --git a/js/codeq/hint.js b/js/codeq/hint.js index d5e27b0..b5468e0 100644 --- a/js/codeq/hint.js +++ b/js/codeq/hint.js @@ -280,7 +280,7 @@ jqMark.popover({ 'content': function () { // decide on what to display only after the popup is triggered, so we can choose the correct translation - return htmlPrefix + translations[codeq.getLang()] + ''; + return htmlPrefix + translations[codeq.settings['gui_lang']] + ''; }, 'html': true, 'placement': 'auto bottom', diff --git a/js/codeq/settings.js b/js/codeq/settings.js index 9e8e499..df704b0 100644 --- a/js/codeq/settings.js +++ b/js/codeq/settings.js @@ -22,7 +22,7 @@ $("#settings_dropdown_menu").on("shown.bs.dropdown", function() { closedWithSave = false; - previousGuiLang = codeq.getLang(); + previousGuiLang = codeq.settings['gui_lang']; previousRobotAddress = robotAddressInput.val(); }).on("hidden.bs.dropdown", function() { if(closedWithSave){ diff --git a/js/codeq/translation.js b/js/codeq/translation.js index dda5aec..154358a 100644 --- a/js/codeq/translation.js +++ b/js/codeq/translation.js @@ -69,7 +69,7 @@ 'emptyDictionary': {}, // use this with registerDictionary when you don't want any translations 'translateDom': function (jqTopElt) { - var lang = codeq.getLang(); + var lang = codeq.settings['gui_lang']; jqTopElt.filter('[data-tkey]').each(function () { translateElement(jqTopElt, lang) }); @@ -82,4 +82,4 @@ return dicts[name]; } }; -})(); \ No newline at end of file +})(); -- cgit v1.2.1 From f48b45f5c7e040a7a6cbe243f6196f77c2b1e895 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Tue, 13 Oct 2015 14:23:02 +0200 Subject: Simplify settings handling --- js/codeq/settings.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/js/codeq/settings.js b/js/codeq/settings.js index df704b0..dd844a5 100644 --- a/js/codeq/settings.js +++ b/js/codeq/settings.js @@ -6,7 +6,6 @@ var guiLangSelect = $('#gui_lang_select'), robotAddressInput = $('#robot_address_input'), previousGuiLang = guiLangSelect.val(), - previousRobotAddress = robotAddressInput.val(), closedWithSave = false; guiLangSelect.on("change",function() { @@ -23,15 +22,10 @@ $("#settings_dropdown_menu").on("shown.bs.dropdown", function() { closedWithSave = false; previousGuiLang = codeq.settings['gui_lang']; - previousRobotAddress = robotAddressInput.val(); }).on("hidden.bs.dropdown", function() { if(closedWithSave){ - var guiLang = guiLangSelect.val(), - newSettings = {'robot_address': robotAddressInput.val()}; - if (guiLang in codeq.supportedLangs) { - newSettings['gui_lang'] = guiLang; - } - codeq.comms.updateSettings(newSettings) + codeq.settings['robot_address'] = robotAddressInput.val(); + codeq.comms.updateSettings(codeq.settings) .then(function (data) { if (data.code !== 0) { throw new Error('Updating settings failed, code: ' + data.code + ', message: ' + data.message); @@ -41,7 +35,7 @@ }else{ guiLangSelect.val(previousGuiLang); if (previousGuiLang in codeq.supportedLangs) codeq.setLang(previousGuiLang); - robotAddressInput.val(previousRobotAddress); + robotAddressInput.val(codeq.settings['robot_address']); } }); })(); -- cgit v1.2.1 From 21b841891f40abaac661d084fd368edfb0ec25da Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Tue, 13 Oct 2015 14:33:48 +0200 Subject: Update Prolog screen layout to match Python --- css/codeq.css | 35 +++++++++++++++++++++++++++++++++++ index.html | 54 ++++++++++++++++++++++++++++++------------------------ 2 files changed, 65 insertions(+), 24 deletions(-) diff --git a/css/codeq.css b/css/codeq.css index a404f11..d457089 100644 --- a/css/codeq.css +++ b/css/codeq.css @@ -184,6 +184,16 @@ body { min-height: 100%; height: 100%; } + /* code_editor */ + #screen_prolog .block.block2 { + min-height: 100%; height: 100%; + } + + /* console */ + #screen_prolog .block.block3 { + min-height: 100%; height: 100%; + } + /* code_editor */ #screen_python .block.block2 { min-height: 100%; height: 100%; @@ -207,6 +217,21 @@ body { min-height: 50%; height: 50%; } + .quadrants#screen_prolog > * > .block { + overflow: auto; + min-height: 100%; height: 100%; + } + + /* code_editor */ + #screen_prolog .block.block2 { + min-height: 50%; height: 50%; + } + + /* console */ + #screen_prolog .block.block3 { + min-height: 50%; height: 50%; + } + .quadrants#screen_python > * > .block { overflow: auto; min-height: 100%; height: 100%; @@ -243,6 +268,16 @@ body { border-right: 1px solid #ddd; } + #screen_prolog .block.block1 { + min-height: 50%; height: 50%; + border-right: 0; + } + + /* hints */ + #screen_prolog .block.block4 { + min-height: 50%; height: 50%; + } + #screen_python .block.block1 { min-height: 50%; height: 50%; border-right: 0; diff --git a/index.html b/index.html index 84829a8..ec2c5dc 100644 --- a/index.html +++ b/index.html @@ -153,34 +153,40 @@ +