From 910a187c04ad4aaf8ce77fd1974502ae027bd609 Mon Sep 17 00:00:00 2001 From: Patrick Jentsch Date: Tue, 5 Nov 2019 10:52:57 +0100 Subject: [PATCH] Add prepare button to corpus --- app/corpora/views.py | 12 ++++++++++++ app/templates/corpora/corpus.html.j2 | 3 +++ 2 files changed, 15 insertions(+) diff --git a/app/corpora/views.py b/app/corpora/views.py index f7bfbd6f..2e5e9130 100644 --- a/app/corpora/views.py +++ b/app/corpora/views.py @@ -79,6 +79,18 @@ def corpus_analysis(corpus_id): title='Corpus: {}'.format(corpus.title)) +@corpora.route('//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('//delete') @login_required def delete_corpus(corpus_id): diff --git a/app/templates/corpora/corpus.html.j2 b/app/templates/corpora/corpus.html.j2 index bf04d74d..7ab6fcf5 100644 --- a/app/templates/corpora/corpus.html.j2 +++ b/app/templates/corpora/corpus.html.j2 @@ -21,7 +21,10 @@
+ {% if corpus.status == 'prepared' %} helpAnalyse + {% endif %} + whatshotPrepare deleteDelete Corpus