diff options
Diffstat (limited to 'assets')
-rw-r--r-- | assets/js/gradings.js | 42 | ||||
-rw-r--r-- | assets/js/lang/bundle.js | 16 | ||||
-rw-r--r-- | assets/pages-src/misc/grading-add-modal.bvr | 23 | ||||
-rw-r--r-- | assets/pages-src/misc/msg-compose-modal.bvr | 4 |
4 files changed, 51 insertions, 34 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", diff --git a/assets/pages-src/misc/grading-add-modal.bvr b/assets/pages-src/misc/grading-add-modal.bvr index eb5f3b7..0b7189d 100644 --- a/assets/pages-src/misc/grading-add-modal.bvr +++ b/assets/pages-src/misc/grading-add-modal.bvr @@ -6,25 +6,20 @@ <h4 class="general-text"><x-su>addGrading</x-su></h4> <div class="row"> - <div class="input-field col s5"> + <div class="input-field col s6"> <input required="required" type="text" class="datepicker" id="datepicker-add"> - <label for="datepicker-add">Date</label> + <label for="datepicker-add"><x-su>date</x-su></label> </div> - <div class="input-field col s5"> - <input required="required" id="event_name" type="text" class="validate"> - <label for="event_name">Name</label> - </div> - <div class="input-field col s2"> - <button id="event_btn" class="btn waves-effect waves-light" type="text" class="validate"> - <i class="material-icons">event_available</i> - </button> + <div class="input-field col s6"> + <input required="required" id="input-grading-name" type="text" class="validate"> + <label for="event_name"><x-su>name</x-su></label> </div> </div> <div class="row"> <div class="input-field col s12"> - <textarea required="required" id="event_description" class="materialize-textarea"></textarea> - <label for="event_description">Description</label> + <textarea required="required" id="input-grading-description" class="materialize-textarea"></textarea> + <label for="event_description"><x-su>description</x-su></label> </div> </div> @@ -32,8 +27,8 @@ <div class="modal-footer"> <div id="modal-footer-right"> - <a href="#" class="modal-close waves-effect waves-green btn-flat">Cancel <i class="material-icons right">close</i></a> - <a href="#" id="msg-send" class="modal-close waves-effect waves-green btn-flat" disabled>Add <i class="material-icons right">add</i></a> + <a href="#" class="modal-close waves-effect waves-green btn-flat"><x-su>cancel</x-su> <i class="material-icons right">close</i></a> + <a href="#" id="btn-add-grading" class="modal-close waves-effect waves-green btn-flat" disabled><x-su>add</x-su> <i class="material-icons right">add</i></a> </div> </div> </div> diff --git a/assets/pages-src/misc/msg-compose-modal.bvr b/assets/pages-src/misc/msg-compose-modal.bvr index 5889214..48afaaf 100644 --- a/assets/pages-src/misc/msg-compose-modal.bvr +++ b/assets/pages-src/misc/msg-compose-modal.bvr @@ -57,8 +57,8 @@ <div class="modal-footer"> <div id="modal-footer-right"> - <a href="#" class="modal-close waves-effect waves-green btn-flat">Cancel <i class="material-icons right">close</i></a> - <a href="#" id="msg-send" class="modal-close waves-effect waves-green btn-flat" disabled>Send <i class="material-icons right">send</i></a> + <a href="#" class="modal-close waves-effect waves-green btn-flat"><x-su>cancel</x-su> <i class="material-icons right">close</i></a> + <a href="#" id="msg-send" class="modal-close waves-effect waves-green btn-flat" disabled><x-su>send</x-su> <i class="material-icons right">send</i></a> </div> </div> </div> |