diff options
author | rstular <rok@stular.eu> | 2020-05-17 15:12:58 +0200 |
---|---|---|
committer | rstular <rok@stular.eu> | 2020-05-17 15:12:58 +0200 |
commit | 89f33d6754e6e619e81d2839d68e5b34e85fdff8 (patch) | |
tree | 1524834e3bea51f161c8a232f4a81172abf930ec /assets/js | |
parent | GSEC bug fix - fetch teachers (diff) | |
download | beziapp-89f33d6754e6e619e81d2839d68e5b34e85fdff8.tar beziapp-89f33d6754e6e619e81d2839d68e5b34e85fdff8.tar.gz beziapp-89f33d6754e6e619e81d2839d68e5b34e85fdff8.tar.bz2 beziapp-89f33d6754e6e619e81d2839d68e5b34e85fdff8.tar.lz beziapp-89f33d6754e6e619e81d2839d68e5b34e85fdff8.tar.xz beziapp-89f33d6754e6e619e81d2839d68e5b34e85fdff8.tar.zst beziapp-89f33d6754e6e619e81d2839d68e5b34e85fdff8.zip |
Diffstat (limited to 'assets/js')
-rw-r--r-- | assets/js/absences.js | 2 | ||||
-rw-r--r-- | assets/js/gradings.js | 2 | ||||
-rw-r--r-- | assets/js/lang/bundle.js | 2 | ||||
-rw-r--r-- | assets/js/settings.js | 14 | ||||
-rw-r--r-- | assets/js/teachers.js | 2 |
5 files changed, 17 insertions, 5 deletions
diff --git a/assets/js/absences.js b/assets/js/absences.js index a11d042..2ed5fe8 100644 --- a/assets/js/absences.js +++ b/assets/js/absences.js @@ -49,7 +49,7 @@ async function loadAbsences(forceRefresh = false) { ]; await Promise.all(promisesToRun); // If we don't have a list of absences, query it - if (absences === null || forceRefresh) { + if (absences === null || absences === {} || forceRefresh) { try { let gsecInstance = new gsec(); await gsecInstance.login(username, password); diff --git a/assets/js/gradings.js b/assets/js/gradings.js index 2aeac27..33fda47 100644 --- a/assets/js/gradings.js +++ b/assets/js/gradings.js @@ -176,7 +176,7 @@ document.addEventListener("DOMContentLoaded", () => { }); calendar_obj.render(); // setupPickers(); // todo (adding an event), to be stored in messages - loadGradings(); + loadGradings(true); // Setup refresh handler $("#refresh-icon").click(() => { loadGradings(true); diff --git a/assets/js/lang/bundle.js b/assets/js/lang/bundle.js index e8ed9d3..b025486 100644 --- a/assets/js/lang/bundle.js +++ b/assets/js/lang/bundle.js @@ -283,6 +283,7 @@ var langstrings = { privacyEffectiveAsOf: "this policy is effective as of", // settings language: "language", + selectLanguage: "select desired language", languageSet: "language set, open another page for the changes to take effect", // gsec gsecErrNet: "GimSIS connection error", @@ -465,6 +466,7 @@ var langstrings = { privacyAcceptWithUse: "your continued use of our website will be regarded as acceptance of our practices around privacy and personal information. If you have any questions about how we handle user data and personal information, feel free to contact us.", privacyEffectiveAsOf: "this policy is effective as of", language: "jezik", + selectLanguage: "izberi željen jezik", languageSet: "jezik nastavljen, odprite neko drugo stran da se pokažejo spremembe", // gsec gsecErrNet: "napaka povezave na GimSIS", diff --git a/assets/js/settings.js b/assets/js/settings.js index fda9ea5..0410aeb 100644 --- a/assets/js/settings.js +++ b/assets/js/settings.js @@ -8,12 +8,22 @@ async function setLanguage(langCode) { } document.addEventListener("DOMContentLoaded", async () => { - $(".settings-language-selector").click(function () { - let languageToSet = $(this).attr("data-language"); + + $("#select-language").on("change", () => { + let languageToSet = $(this).find(":selected").data("language"); setLanguage(languageToSet); }); + localforage.getItem("chosenLang").then((value) => { + let selectedLanguage = value ?? "sl"; + $(`#option-${selectedLanguage}`).attr("selected", true); + }).catch(() => {}); + // Setup side menu const menus = document.querySelectorAll(".side-menu"); M.Sidenav.init(menus, { edge: "right", draggable: true }); + + // Setup language select dropdown + var elems = document.querySelectorAll('select'); + M.FormSelect.init(elems, {}); }); diff --git a/assets/js/teachers.js b/assets/js/teachers.js index 5fc2baf..da69e96 100644 --- a/assets/js/teachers.js +++ b/assets/js/teachers.js @@ -29,7 +29,7 @@ async function loadTeachers(force_refresh = false) { ]; await Promise.all(promises_to_run); // If we don't have a list of teachers, query it - if (teachers === null || force_refresh) { + if (teachers === null || teachers === [] || force_refresh) { try { let gsecInstance = new gsec(); await gsecInstance.login(username, password); |