diff --git a/app/static/js/nopaque.js b/app/static/js/nopaque.js index 629a4434..bae1d8a4 100644 --- a/app/static/js/nopaque.js +++ b/app/static/js/nopaque.js @@ -19,8 +19,16 @@ nopaque.foreignJobsSubscribers = []; // nopaque functions -nopaque.forms = {}; -nopaque.forms.init = function() { +nopaque.Workarounds = {}; +nopaque.Workarounds.apply = function() { + // Disable all option elements with no value + for (let optionElement of document.querySelectorAll('option[value=""]')) { + optionElement.disabled = true; + } +} + +nopaque.Forms = {}; +nopaque.Forms.init = function() { var abortRequestElement, parentElement, progressElement, progressModal, progressModalElement, request, submitElement; @@ -30,13 +38,14 @@ nopaque.forms.init = function() { for (let selectElement of form.querySelectorAll('select')) { if (selectElement.value === "") { parentElement = selectElement.closest(".input-field"); + parentElement.querySelector(".select-dropdown").classList.add("invalid"); for (let helperTextElement of parentElement.querySelectorAll(".helper-text")) { helperTextElement.remove(); } parentElement.insertAdjacentHTML("beforeend", `Please select an option.`); } } - }) + }); request = new XMLHttpRequest(); if (form.dataset.hasOwnProperty("progressModal")) { @@ -91,24 +100,14 @@ nopaque.forms.init = function() { } } -nopaque.navigation = {}; -nopaque.navigation.init = function() { - var slideOutElement, tocElement; - - slideOutElement = document.getElementById("slide-out"); - for (let entry of slideOutElement.querySelectorAll("a:not(.subheader)")) { +nopaque.Navigation = {}; +nopaque.Navigation.init = function() { + /* ### Initialize sidenav-main ### */ + for (let entry of document.querySelectorAll("#sidenav-main a")) { if (entry.href === window.location.href) { entry.parentNode.classList.add("active"); } } - tocElement = document.getElementById("roadmap"); - if (tocElement) { - for (let entry of tocElement.querySelectorAll("a")) { - if (entry.href === window.location.href) { - entry.classList.add("active"); - } - } - } } @@ -223,11 +222,12 @@ nopaque.socket.on("match_context", function(message) { }); document.addEventListener("DOMContentLoaded", function() { + nopaque.Workarounds.apply(); M.AutoInit(); M.CharacterCounter.init(document.querySelectorAll('input[data-length][type="text"]')); M.Dropdown.init(document.querySelectorAll("#nav-notifications, #nav-account"), {alignment: "right", constrainWidth: false, coverTrigger: false}); - nopaque.forms.init(); - nopaque.navigation.init(); + nopaque.Forms.init(); + nopaque.Navigation.init(); nopaque.socket.emit("user_ressources_init"); }); diff --git a/app/templates/jobs/job.html.j2 b/app/templates/jobs/job.html.j2 index b0e10fe1..faef08ee 100644 --- a/app/templates/jobs/job.html.j2 +++ b/app/templates/jobs/job.html.j2 @@ -138,7 +138,7 @@ diff --git a/app/templates/nopaque.html.j2 b/app/templates/nopaque.html.j2 index 9b11b5df..7e4554d3 100644 --- a/app/templates/nopaque.html.j2 +++ b/app/templates/nopaque.html.j2 @@ -56,7 +56,7 @@ {% endif %} -