Add message if corpus is empty

This commit is contained in:
Patrick Jentsch 2020-04-15 12:49:26 +02:00
parent bbccbcfcd2
commit b251f9993d
2 changed files with 16 additions and 5 deletions

View File

@ -68,6 +68,10 @@ indicator will show up how the column is sorted right now.; */
z-index: 999; /* tmp fix */
}
.show-if-only-child:not(:only-child) {
display: none !important;
}
/* class for expert view */
.expert-view {
cursor: pointer;

View File

@ -36,7 +36,7 @@
<div class="card-action right-align">
<a href="{{ url_for('corpora.analyse_corpus', corpus_id=corpus.id) }}" class="btn disabled hide waves-effect waves-light" id="analyze"><i class="material-icons left">search</i>Analyze</a>
{% if corpus.files[0] is defined %}
<a href="{{ url_for('corpora.prepare_corpus', corpus_id=corpus.id) }}" class="btn disabled hide waves-effect waves-light" id="build"><i class="material-icons left">build</i>Build</a>
<a href="{{ url_for('corpora.prepare_corpus', corpus_id=corpus.id) }}" class="btn disabled hide waves-effect waves-light" id="compile"><i class="material-icons left">merge_type</i>Compile</a>
{% endif %}
<a data-target="delete-corpus-modal" class="btn modal-trigger red waves-effect waves-light"><i class="material-icons left">delete</i>Delete</a>
</div>
@ -49,6 +49,7 @@
<div class="card">
<div class="card-content" style="overflow: hidden;">
<span class="card-title">Files</span>
<table class="highlight responsive-table">
<thead>
<tr>
@ -60,6 +61,12 @@
</tr>
</thead>
<tbody>
<tr class="show-if-only-child">
<td colspan="5">
<span class="card-title"><i class="material-icons left">book</i>Nothing here...</span>
<p>Corpus is empty. Add texts using the option below.</p>
</td>
</tr>
{% for file in corpus.files %}
<tr>
<td>{{ file.filename }}</td>
@ -160,7 +167,7 @@
}
setStatus(status) {
let analyzeElement, buildElement, progressIndicatorElement, statusElement;
let analyzeElement, compileElement, progressIndicatorElement, statusElement;
progressIndicatorElement = document.getElementById("progress-indicator");
if (["queued", "running", "start analysis", "stop analysis"].includes(status)) {
@ -180,11 +187,11 @@
analyzeElement.classList.add("disabled", "hide");
}
buildElement = document.getElementById("build");
compileElement = document.getElementById("compile");
if (status === 'unprepared') {
buildElement.classList.remove("disabled", "hide");
compileElement.classList.remove("disabled", "hide");
} else {
buildElement.classList.add("disabled", "hide");
compileElement.classList.add("disabled", "hide");
}
}
}