Show buttons only on wanted status

This commit is contained in:
Stephan Porada 2019-11-06 10:04:01 +01:00
parent da077cae3f
commit 2d4559e4fe

View File

@ -61,6 +61,12 @@
statusElement.classList.remove(...Object.values(CorpusList.STATUS_COLORS)); statusElement.classList.remove(...Object.values(CorpusList.STATUS_COLORS));
statusElement.classList.add(CorpusList.STATUS_COLORS[status] || CorpusList.STATUS_COLORS['default']); statusElement.classList.add(CorpusList.STATUS_COLORS[status] || CorpusList.STATUS_COLORS['default']);
statusElement.innerText = status; statusElement.innerText = status;
if (status === 'prepared') {
var analyseBtn = document.getElementById('analyse');
analyseBtn.classList.remove('hide');
var prepareBtn = document.getElementById('prepare');
prepareBtn.classList.add('hide')
}
} }
} }
@ -87,11 +93,9 @@
</div> </div>
</div> </div>
<div class="card-action right-align"> <div class="card-action right-align">
{% if corpus.status == 'prepared' %} <a href="{{ url_for('corpora.corpus_analysis', corpus_id=corpus.id) }}" class="waves-effect waves-light btn hide" id="analyse"><i class="material-icons left">help</i>Analyse</a>
<a href="{{ url_for('corpora.corpus_analysis', corpus_id=corpus.id) }}" class="waves-effect waves-light btn"><i class="material-icons left">help</i>Analyse</a>
{% endif %}
{% if corpus.files[0] is defined %} {% if corpus.files[0] is defined %}
<a href="{{ url_for('corpora.prepare_corpus', corpus_id=corpus.id) }}" class="waves-effect waves-light btn"><i class="material-icons left">whatshot</i>Prepare</a> <a href="{{ url_for('corpora.prepare_corpus', corpus_id=corpus.id) }}" class="waves-effect waves-light btn" id="prepare"><i class="material-icons left">whatshot</i>Prepare</a>
{% endif %} {% endif %}
<a data-target="delete-corpus-modal" class="waves-effect waves-light btn red modal-trigger"><i class="material-icons left">delete</i>Delete Corpus</a> <a data-target="delete-corpus-modal" class="waves-effect waves-light btn red modal-trigger"><i class="material-icons left">delete</i>Delete Corpus</a>
</div> </div>