diff options
author | rstular <rok@stular.eu> | 2020-06-01 20:49:56 +0200 |
---|---|---|
committer | rstular <rok@stular.eu> | 2020-06-01 20:55:06 +0200 |
commit | 35b595f806f99ca18365d511ab820ab818da348d (patch) | |
tree | 353363f3883be5457cce00297f7bc1f6ef289056 /assets/js | |
parent | gsec bug fix (subject must not be null), UI fix (diff) | |
download | beziapp-35b595f806f99ca18365d511ab820ab818da348d.tar beziapp-35b595f806f99ca18365d511ab820ab818da348d.tar.gz beziapp-35b595f806f99ca18365d511ab820ab818da348d.tar.bz2 beziapp-35b595f806f99ca18365d511ab820ab818da348d.tar.lz beziapp-35b595f806f99ca18365d511ab820ab818da348d.tar.xz beziapp-35b595f806f99ca18365d511ab820ab818da348d.tar.zst beziapp-35b595f806f99ca18365d511ab820ab818da348d.zip |
Diffstat (limited to 'assets/js')
-rw-r--r-- | assets/js/gradings.js | 42 | ||||
-rw-r--r-- | assets/js/lang/bundle.js | 16 |
2 files changed, 40 insertions, 18 deletions
diff --git a/assets/js/gradings.js b/assets/js/gradings.js index a852337..bd664bb 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,19 @@ 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,14 +188,16 @@ document.addEventListener("DOMContentLoaded", () => { calendar_obj.render(); // Modal for adding gradings - setupPickers(); // todo (adding an event), to be stored in messages + setupPickers(); // TODO: Hook up submit logic // Setup modals const modal_elems = document.querySelectorAll('.modal'); const modal_options = { onOpenStart: () => { $("#fab-new").hide() }, onCloseEnd: () => { $("#fab-new").show() }, dismissible: false - }; + }; + $("#input-grading-name").on("blur", validateInputs); + $("#input-grading-description").on("blur", validateInputs); M.Modal.init(modal_elems, modal_options); loadGradings(true); diff --git a/assets/js/lang/bundle.js b/assets/js/lang/bundle.js index 2cd78bc..49e64ac 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,6 +158,9 @@ 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", @@ -187,6 +190,7 @@ var langstrings = { // messaging loadingMessages: "Loading messages...", sendAMessage: "send a message", + send: "send", recipient: "recipient", messageSubject: "subject", messageBody: "message body", @@ -227,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", @@ -360,6 +364,9 @@ var langstrings = { logout: "odjava", settings: "nastavitve", // gradings + date: "datum", + description: "opis", + add: "dodaj", requestFailed: "zahteva spodletela", addGrading: "dodaj ocenjevanje", noInternetConnection: "ni povezave s spletom", @@ -378,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", @@ -389,6 +396,7 @@ var langstrings = { // messaging loadingMessages: "Nalagam sporočila...", sendAMessage: "pošlji sporočilo", + send: "pošlji", recipient: "prejemnik", messageSubject: "zadeva", messageBody: "telo", |