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