Merge branch 'development' of gitlab.ub.uni-bielefeld.de:sfb1288inf/opaque into development

This commit is contained in:
stephan
2020-02-18 14:54:19 +01:00
4 changed files with 30 additions and 25 deletions

View File

@ -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", `<span class="helper-text red-text">Please select an option.</span>`);
}
}
})
});
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");
});