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
commit ad588c4344
4 changed files with 30 additions and 25 deletions

View File

@ -19,8 +19,16 @@ nopaque.foreignJobsSubscribers = [];
// nopaque functions // nopaque functions
nopaque.forms = {}; nopaque.Workarounds = {};
nopaque.forms.init = function() { 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, var abortRequestElement, parentElement, progressElement, progressModal,
progressModalElement, request, submitElement; progressModalElement, request, submitElement;
@ -30,13 +38,14 @@ nopaque.forms.init = function() {
for (let selectElement of form.querySelectorAll('select')) { for (let selectElement of form.querySelectorAll('select')) {
if (selectElement.value === "") { if (selectElement.value === "") {
parentElement = selectElement.closest(".input-field"); parentElement = selectElement.closest(".input-field");
parentElement.querySelector(".select-dropdown").classList.add("invalid");
for (let helperTextElement of parentElement.querySelectorAll(".helper-text")) { for (let helperTextElement of parentElement.querySelectorAll(".helper-text")) {
helperTextElement.remove(); helperTextElement.remove();
} }
parentElement.insertAdjacentHTML("beforeend", `<span class="helper-text red-text">Please select an option.</span>`); parentElement.insertAdjacentHTML("beforeend", `<span class="helper-text red-text">Please select an option.</span>`);
} }
} }
}) });
request = new XMLHttpRequest(); request = new XMLHttpRequest();
if (form.dataset.hasOwnProperty("progressModal")) { if (form.dataset.hasOwnProperty("progressModal")) {
@ -91,24 +100,14 @@ nopaque.forms.init = function() {
} }
} }
nopaque.navigation = {}; nopaque.Navigation = {};
nopaque.navigation.init = function() { nopaque.Navigation.init = function() {
var slideOutElement, tocElement; /* ### Initialize sidenav-main ### */
for (let entry of document.querySelectorAll("#sidenav-main a")) {
slideOutElement = document.getElementById("slide-out");
for (let entry of slideOutElement.querySelectorAll("a:not(.subheader)")) {
if (entry.href === window.location.href) { if (entry.href === window.location.href) {
entry.parentNode.classList.add("active"); 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() { document.addEventListener("DOMContentLoaded", function() {
nopaque.Workarounds.apply();
M.AutoInit(); M.AutoInit();
M.CharacterCounter.init(document.querySelectorAll('input[data-length][type="text"]')); M.CharacterCounter.init(document.querySelectorAll('input[data-length][type="text"]'));
M.Dropdown.init(document.querySelectorAll("#nav-notifications, #nav-account"), M.Dropdown.init(document.querySelectorAll("#nav-notifications, #nav-account"),
{alignment: "right", constrainWidth: false, coverTrigger: false}); {alignment: "right", constrainWidth: false, coverTrigger: false});
nopaque.forms.init(); nopaque.Forms.init();
nopaque.navigation.init(); nopaque.Navigation.init();
nopaque.socket.emit("user_ressources_init"); nopaque.socket.emit("user_ressources_init");
}); });

View File

@ -138,7 +138,7 @@
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<a href="#!" class="modal-close waves-effect waves-green btn cancel">Cancel</a> <a href="#!" class="modal-close waves-effect waves-green btn cancel">Cancel</a>
<a class="modal-close waves-effect waves-green btn red" href="{{ url_for('jobs.delete_job', job_id=job.id) }}">Confirm<i class="material-icons right">send</i></a> <a class="modal-close waves-effect waves-green btn red" href="{{ url_for('jobs.delete_job', job_id=job.id) }}">Delete<i class="material-icons right">send</i></a>
</div> </div>
</div> </div>

View File

@ -56,7 +56,7 @@
{% endif %} {% endif %}
</ul> </ul>
<ul id="slide-out" class="sidenav sidenav-fixed"> <ul id="sidenav-main" class="sidenav sidenav-fixed">
<li><a href="{{ url_for('main.index') }}"><i class="material-icons">opacity</i>nopaque</a></li> <li><a href="{{ url_for('main.index') }}"><i class="material-icons">opacity</i>nopaque</a></li>
<li><a href="#"><i class="material-icons">linear_scale</i>Workflow</a></li> <li><a href="#"><i class="material-icons">linear_scale</i>Workflow</a></li>
<li><a href="{{ url_for('main.dashboard') }}"><i class="material-icons">dashboard</i>Dashboard</a></li> <li><a href="{{ url_for('main.dashboard') }}"><i class="material-icons">dashboard</i>Dashboard</a></li>
@ -128,6 +128,11 @@
<li><a href="{{ url_for('services.service', service='corpus_analysis') }}">Corpus analysis</a></li> <li><a href="{{ url_for('services.service', service='corpus_analysis') }}">Corpus analysis</a></li>
</ul> </ul>
</div> </div>
<script>
for (let entry of document.querySelectorAll(`#roadmap a`)) {
if (entry.href === window.location.href) {entry.classList.add("active");}
}
</script>
{% endif %} {% endif %}
</div> </div>
{% if not full_width %} {% if not full_width %}

View File

@ -42,7 +42,7 @@
<div class="col s12 m4"> <div class="col s12 m4">
<div class="input-field"> <div class="input-field">
<i class="material-icons prefix">title</i> <i class="material-icons prefix">title</i>
{{ add_job_form.title(data_length='32') }} {{ add_job_form.title(class="validate", data_length='32') }}
{{ add_job_form.title.label }} {{ add_job_form.title.label }}
{% for error in add_job_form.title.errors %} {% for error in add_job_form.title.errors %}
<span class="helper-text red-text">{{ error }}</span> <span class="helper-text red-text">{{ error }}</span>
@ -52,7 +52,7 @@
<div class="col s12 m8"> <div class="col s12 m8">
<div class="input-field"> <div class="input-field">
<i class="material-icons prefix">description</i> <i class="material-icons prefix">description</i>
{{ add_job_form.description(data_length='255') }} {{ add_job_form.description(class="validate", data_length='255') }}
{{ add_job_form.description.label }} {{ add_job_form.description.label }}
{% for error in add_job_form.description.errors %} {% for error in add_job_form.description.errors %}
<span class="helper-text red-text">{{ error }}</span> <span class="helper-text red-text">{{ error }}</span>
@ -76,7 +76,7 @@
<div class="col s12 m4"> <div class="col s12 m4">
<div class="input-field"> <div class="input-field">
<i class="material-icons prefix">language</i> <i class="material-icons prefix">language</i>
{{ add_job_form.language() }} {{ add_job_form.language(class="validate") }}
{{ add_job_form.language.label }} {{ add_job_form.language.label }}
{% for error in add_job_form.language.errors %} {% for error in add_job_form.language.errors %}
<span class="helper-text red-text">{{ error }}</span> <span class="helper-text red-text">{{ error }}</span>
@ -86,7 +86,7 @@
<div class="col s12 m3"> <div class="col s12 m3">
<div class="input-field"> <div class="input-field">
<i class="material-icons prefix">apps</i> <i class="material-icons prefix">apps</i>
{{ add_job_form.version() }} {{ add_job_form.version(class="validate") }}
{{ add_job_form.version.label }} {{ add_job_form.version.label }}
{% for error in add_job_form.version.errors %} {% for error in add_job_form.version.errors %}
<span class="helper-text red-text">{{ error }}</span> <span class="helper-text red-text">{{ error }}</span>