summaryrefslogtreecommitdiffstats
path: root/assets/js/settings.js
diff options
context:
space:
mode:
authorrstular <rok@stular.eu>2020-05-17 15:12:58 +0200
committerrstular <rok@stular.eu>2020-05-17 15:12:58 +0200
commit89f33d6754e6e619e81d2839d68e5b34e85fdff8 (patch)
tree1524834e3bea51f161c8a232f4a81172abf930ec /assets/js/settings.js
parentGSEC bug fix - fetch teachers (diff)
downloadbeziapp-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/settings.js')
-rw-r--r--assets/js/settings.js14
1 files changed, 12 insertions, 2 deletions
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, {});
});