init materialize elements the right way.

This commit is contained in:
Patrick Jentsch 2019-11-12 16:16:41 +01:00
parent 5660318450
commit 28171eb525
3 changed files with 24 additions and 17 deletions

View File

@ -182,14 +182,7 @@
document.getElementById("nav-account"), document.getElementById("nav-account"),
{"alignment": "right", "constrainWidth": false, "coverTrigger": false} {"alignment": "right", "constrainWidth": false, "coverTrigger": false}
); );
M.Dropdown.init( // Highlight current navigation entry
document.getElementById("new-job"),
{"coverTrigger": false}
);
var loadingModal = document.getElementById("loading-modal");
console.log(loadingModal);
M.Modal.init(loadingModal, {"dismissible": false});
M.Modal.getInstance(loadingModal).open();
var entry; var entry;
for (entry of document.querySelectorAll("#slide-out a:not(.subheader)")) { for (entry of document.querySelectorAll("#slide-out a:not(.subheader)")) {
if (entry.href === window.location.href) { if (entry.href === window.location.href) {

View File

@ -1,15 +1,6 @@
{% extends "full_width.html.j2" %} {% extends "full_width.html.j2" %}
{% block page_content %} {% block page_content %}
<script>
socket.emit('init_corpus_analysis', {{ corpus_id }});
socket.on('init_corpus_analysis', function(msg) {
if (msg === 'Ready') {M.Modal.getInstance(document.getElementById("loading-modal")).close();}
});
</script>
<div class="col s12 m3 l3 sticky"> <div class="col s12 m3 l3 sticky">
<a class="waves-effect waves-light btn" href="{{ url_for('corpora.corpus', corpus_id=corpus_id) }}"><i class="material-icons left">arrow_back</i>Back to corpus overview</a> <a class="waves-effect waves-light btn" href="{{ url_for('corpora.corpus', corpus_id=corpus_id) }}"><i class="material-icons left">arrow_back</i>Back to corpus overview</a>
<div class="card"> <div class="card">
@ -141,4 +132,18 @@ function sendQueryData() {
</div> </div>
</div> </div>
</div> </div>
<script>
var loadingModal;
document.addEventListener('DOMContentLoaded', function() {
loadingModal = M.Modal.init(document.getElementById("loading-modal"), {"dismissible": false});
loadingModal.open();
});
socket.emit('init_corpus_analysis', {{ corpus_id }});
socket.on('init_corpus_analysis', function(msg) {
if (msg === 'Ready') {loadingModal.close();}
});
</script>
{% endblock %} {% endblock %}

View File

@ -89,4 +89,13 @@
<li><a href="{{ url_for('services.service', service='nlp') }}"><i class="material-icons">format_textdirection_l_to_r</i>NLP</a></li> <li><a href="{{ url_for('services.service', service='nlp') }}"><i class="material-icons">format_textdirection_l_to_r</i>NLP</a></li>
<li><a href="{{ url_for('services.service', service='ocr') }}"><i class="material-icons">find_in_page</i>OCR</a></li> <li><a href="{{ url_for('services.service', service='ocr') }}"><i class="material-icons">find_in_page</i>OCR</a></li>
</ul> </ul>
<script>
document.addEventListener('DOMContentLoaded', function() {
M.Dropdown.init(
document.getElementById("new-job"),
{"coverTrigger": false}
);
});
</script>
{% endblock %} {% endblock %}