Add prepare button to corpus

This commit is contained in:
Patrick Jentsch 2019-11-05 10:52:57 +01:00
parent 787c6e75b3
commit 910a187c04
2 changed files with 15 additions and 0 deletions

View File

@ -79,6 +79,18 @@ def corpus_analysis(corpus_id):
title='Corpus: {}'.format(corpus.title))
@corpora.route('/<int:corpus_id>/prepare')
@login_required
def prepare_corpus(corpus_id):
corpus = Corpus.query.get_or_404(corpus_id)
if not (corpus.creator == current_user or current_user.is_administrator()):
abort(403)
corpus.status = 'preparable'
db.session.commit()
flash('Corpus marked for preparation!')
return redirect(url_for('corpora.corpus', corpus_id=corpus_id))
@corpora.route('/<int:corpus_id>/delete')
@login_required
def delete_corpus(corpus_id):

View File

@ -21,7 +21,10 @@
</div>
</div>
<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"><i class="material-icons left">help</i>Analyse</a>
{% endif %}
<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 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>