diff options
Diffstat (limited to 'assets/js')
-rw-r--r-- | assets/js/gradings.js | 40 | ||||
-rw-r--r-- | assets/js/lang/bundle.js | 20 | ||||
-rw-r--r-- | assets/js/setup-storage.js | 2 |
3 files changed, 44 insertions, 18 deletions
diff --git a/assets/js/gradings.js b/assets/js/gradings.js index f884bf2..4730248 100644 --- a/assets/js/gradings.js +++ b/assets/js/gradings.js @@ -131,6 +131,18 @@ function displayData() { calendar_obj.addEventSource(transformed_gradings); } +async function validateInputs() { + if ($("#input-grading-name").val() != null && $("#input-grading-name").val().length > 0) { + $("#btn-add-grading").removeAttr("disabled"); + $("#input-grading-name").addClass("valid"); + $("#input-grading-name").removeClass("invalid"); + } else { + $("#btn-add-grading").attr("disabled", "disabled"); + $("#input-grading-name").addClass("invalid"); + $("#input-grading-name").removeClass("valid"); + } +} + function gradingClickHandler(eventClickInfo) { let grading_id = parseInt(eventClickInfo.event.id); let grading_subject = gradings[grading_id]["subject"]; @@ -144,19 +156,21 @@ function gradingClickHandler(eventClickInfo) { M.Sidenav.getInstance(modal).open(); } - function setupPickers() { - // Setup pickers, todo (adding an event), to be stored in messages - var date_object = new Date(); - let elems = document.querySelectorAll('#datepicker-add'); - let options = { - autoClose: true, - format: "dd.mm.yyyy", - defaultDate: date_object, - setDefaultDate: true, - firstDay: 1 - } - instances = M.Datepicker.init(elems, options); + +function setupPickers() { + // Setup pickers, todo (adding an event), to be stored in messages + var date_object = new Date(); + let elems = document.querySelectorAll('#datepicker-add'); + let options = { + autoClose: true, + format: "dd.mm.yyyy", + defaultDate: date_object, + setDefaultDate: true, + firstDay: 1 } + instances = M.Datepicker.init(elems, options); +} + document.addEventListener("DOMContentLoaded", () => { @@ -176,6 +190,7 @@ document.addEventListener("DOMContentLoaded", () => { calendar_obj.render(); // Modal for adding gradings + // setupPickers(); // todo (adding an event), to be stored in messages // // Setup modals // const modal_elems = document.querySelectorAll('.modal'); @@ -186,6 +201,7 @@ document.addEventListener("DOMContentLoaded", () => { // }; // M.Modal.init(modal_elems, modal_options); + loadGradings(true); // Setup refresh handler $("#refresh-icon").click(() => { diff --git a/assets/js/lang/bundle.js b/assets/js/lang/bundle.js index 8270527..eeee695 100644 --- a/assets/js/lang/bundle.js +++ b/assets/js/lang/bundle.js @@ -10,7 +10,7 @@ var dateString = { return mesecileta[mesl]; }, longFormatted: (dateObject) => { - return dateString.day(dateObject.getDay())+", "+(dateObject.getDate())+". "+dateString.month(dateObject.getMonth())+" "+dateObject.getFullYear(); + return `${dateString.day(dateObject.getDay())}, ${(dateObject.getDate())}. ${dateString.month(dateObject.getMonth())} ${dateObject.getFullYear()}`; } }; async function refreshLangDOM() { @@ -143,7 +143,7 @@ var langstrings = { and: "and", thePrivacyPolicy: "the privacy policy", loginFailed: "login failed", - browserNotSupported: "bežiapp won't work on your device, unless you update your Internet browser", + browserNotSupported: "bežiapp won't work on your device, unless you update your Internet browser", // index timetable: "timetable", gradings: "gradings", @@ -158,7 +158,11 @@ var langstrings = { // timetable noPeriods: "no periods in selected week", // gradings + date: "date", + description: "description", + add: "add", requestFailed: "request failed", + addGrading: "add grading", noInternetConnection: "no internet connection", // grades temporary: "temporary", @@ -186,6 +190,7 @@ var langstrings = { // messaging loadingMessages: "Loading messages...", sendAMessage: "send a message", + send: "send", recipient: "recipient", messageSubject: "subject", messageBody: "message body", @@ -226,7 +231,7 @@ var langstrings = { recipientNotInDirectory: "recipient is not in directory.", chatExternalInfo: "you have just received a chat. Chats are not supported by GimSIS, so you must reply by changing the subject to something else. Chat body: ", // meals - loginError: "login error", + loginError: "login error", loginToLopolis: "login to Lopolis", loginToLopolisNote: "it seems like you're not currently logged in to eRestavracija, so this form has been presented to you. You have a different username and password combination used for applying and opting out of of menus. In order to use this feature, you have to log in with your Lopolis account.", logInToLopolis: "log in to Lopolis", @@ -359,7 +364,11 @@ var langstrings = { logout: "odjava", settings: "nastavitve", // gradings + date: "datum", + description: "opis", + add: "dodaj", requestFailed: "zahteva spodletela", + addGrading: "dodaj ocenjevanje", noInternetConnection: "ni povezave s spletom", // grades temporary: "začasno", @@ -376,7 +385,7 @@ var langstrings = { // absences from: "od", to: "do", - cancel: "preklic", + cancel: "prekliči", ok: "v redu", noAbsences: "ni izostankov v izbranem časovnem obdobju", lesson: "ura", @@ -387,6 +396,7 @@ var langstrings = { // messaging loadingMessages: "Nalagam sporočila...", sendAMessage: "pošlji sporočilo", + send: "pošlji", recipient: "prejemnik", messageSubject: "zadeva", messageBody: "telo", @@ -499,7 +509,7 @@ var langstrings = { on: "vklopljeno", off: "izklopljeno", selectErrorReporting: "ali naj so napake v aplikaciji posredovane razvijalcem?", - triggerWarning: "spodnji gumb omogoči dodatne možnosti, ki lahko razburijo/vznevoljijo nekatere uporabnike. Če omogočite stikalo se strinjate, da avtorjev in/ali njihovih osebnih prepričanj ne boste povezovali s katerokoli od dodatnih omogočenih možnosti.", + triggerWarning: "spodnji gumb omogoči dodatne možnosti, ki lahko razburijo/vznevoljijo nekatere uporabnike. Če omogočite stikalo, se strinjate, da avtorjev in/ali njihovih osebnih prepričanj ne boste povezovali s katerokoli od dodatnih omogočenih možnosti", triggerAgreement: "strinjam se z zgoraj navedenimi pogoji", triggerWarningSet: "spremenili ste stanje dodatnih nastavitev", additionalOptions: "dodatne nastavitve", diff --git a/assets/js/setup-storage.js b/assets/js/setup-storage.js index 0d2552a..c862d5f 100644 --- a/assets/js/setup-storage.js +++ b/assets/js/setup-storage.js @@ -15,7 +15,7 @@ async function setupStorage(force = false) { localforage.setItem("gradings", []), localforage.setItem("grades", []), localforage.setItem("absences", {}), - localforage.setItem("messages", { "0": [], "1": [], "2": []}), // see messages.js:129, commit 8eb9ca9caca30fbbe023243657535ab4088be377 + localforage.setItem("messages", [[], [], []]), // see messages.js:129, commit 8eb9ca9caca30fbbe023243657535ab4088be377 localforage.setItem("directory", {}), //\\ well I could remember my own code but I didn't. localforage.setItem("meals", {}), localforage.setItem("chosenLang", "en"), |