diff options
Diffstat (limited to '')
-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 | ||||
-rw-r--r-- | assets/pages-src/settings.bvr | 11 | ||||
-rw-r--r-- | dist/js/absences.js | 2 | ||||
-rw-r--r-- | dist/js/gradings.js | 2 | ||||
-rw-r--r-- | dist/js/lang/bundle.js | 2 | ||||
-rw-r--r-- | dist/js/settings.js | 14 | ||||
-rw-r--r-- | dist/js/teachers.js | 2 | ||||
-rw-r--r-- | dist/pages/about.html | 2 | ||||
-rw-r--r-- | dist/pages/settings.html | 11 | ||||
-rw-r--r-- | dist/sw.js | 4 |
14 files changed, 55 insertions, 17 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); diff --git a/assets/pages-src/settings.bvr b/assets/pages-src/settings.bvr index 12c28d7..135ca91 100644 --- a/assets/pages-src/settings.bvr +++ b/assets/pages-src/settings.bvr @@ -55,7 +55,14 @@ </div> <div class="row"> <h5><x-su>language</x-su></h5> - <div class="col s12"> + <div class="input-field col s12"> + <select class="icons" id="select-language"> + <option value="" id="option-sl" data-language="sl" data-icon="/img/flags/sl.svg" selected>Slovenščina</option> + <option value="" id="option-en" data-language="en" data-icon="/img/flags/en.svg">English</option> + </select> + <label><x-su>selectLanguage</x-su></label> + </div> + <!-- <div class="col s12"> <div class="collection"> <a data-language="sl" class="collection-item settings-language-selector" href="#"> <div> @@ -103,7 +110,7 @@ </li> --> </div> - </div> + </div> --> </div> </div> </body> diff --git a/dist/js/absences.js b/dist/js/absences.js index a11d042..2ed5fe8 100644 --- a/dist/js/absences.js +++ b/dist/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/dist/js/gradings.js b/dist/js/gradings.js index 2aeac27..33fda47 100644 --- a/dist/js/gradings.js +++ b/dist/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/dist/js/lang/bundle.js b/dist/js/lang/bundle.js index e8ed9d3..b025486 100644 --- a/dist/js/lang/bundle.js +++ b/dist/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/dist/js/settings.js b/dist/js/settings.js index fda9ea5..0410aeb 100644 --- a/dist/js/settings.js +++ b/dist/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/dist/js/teachers.js b/dist/js/teachers.js index 5fc2baf..da69e96 100644 --- a/dist/js/teachers.js +++ b/dist/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); diff --git a/dist/pages/about.html b/dist/pages/about.html index 7e193bf..c5cc254 100644 --- a/dist/pages/about.html +++ b/dist/pages/about.html @@ -142,7 +142,7 @@ <div class="row"> <p> <small> - ^HEAD 44e8c1e1c9124b36a78f775b9a7dd12152a71d98 + ^HEAD a6b27a276c6da60d7fa21c5d767ef7d38c9fac2a </p> </div> </div> diff --git a/dist/pages/settings.html b/dist/pages/settings.html index 9b33d5a..af9d36d 100644 --- a/dist/pages/settings.html +++ b/dist/pages/settings.html @@ -76,7 +76,14 @@ </div> <div class="row"> <h5><x-su>language</x-su></h5> - <div class="col s12"> + <div class="input-field col s12"> + <select class="icons" id="select-language"> + <option value="" id="option-sl" data-language="sl" data-icon="/img/flags/sl.svg" selected>Slovenščina</option> + <option value="" id="option-en" data-language="en" data-icon="/img/flags/en.svg">English</option> + </select> + <label><x-su>selectLanguage</x-su></label> + </div> + <!-- <div class="col s12"> <div class="collection"> <a data-language="sl" class="collection-item settings-language-selector" href="#"> <div> @@ -124,7 +131,7 @@ </li> --> </div> - </div> + </div> --> </div> </div> </body> @@ -3,8 +3,8 @@ // Change version to cause cache refresh -const static_cache_name = "site-static-1.0.13-beta-44e8c1e"; -// latest commit is 44e8c1e1c9124b36a78f775b9a7dd12152a71d98 +const static_cache_name = "site-static-1.0.13-beta-a6b27a2"; +// latest commit is a6b27a276c6da60d7fa21c5d767ef7d38c9fac2a // Got them with find . -not -path '*/\.*' | sed "s/.*/\"&\",/" | grep -v sw.js // sw.js NE SME BITI CACHAN, ker vsebuje verzijo! |