From 338e760bfb98844bd2edcd4f6f8196e7d283248d Mon Sep 17 00:00:00 2001 From: Patrick Jentsch Date: Wed, 15 Apr 2020 10:32:21 +0200 Subject: [PATCH] Hide analyze button if corpus is not ready for this --- app/corpora/cqi/models/corpora.py | 3 +++ app/static/css/nopaque.css | 3 +++ app/static/js/nopaque.lists.js | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/corpora/cqi/models/corpora.py b/app/corpora/cqi/models/corpora.py index 0f67e195..8c282794 100644 --- a/app/corpora/cqi/models/corpora.py +++ b/app/corpora/cqi/models/corpora.py @@ -61,6 +61,9 @@ class Corpus(Model): subattr_value return lookups + def drop(self): + return self.client.api.corpus_drop_corpus(self.attrs['api_name']) + def query(self, query, subcorpus_name='Results'): return self.client.api.cqp_query(self.attrs['api_name'], subcorpus_name, query) diff --git a/app/static/css/nopaque.css b/app/static/css/nopaque.css index 17e8803b..1e3763dd 100644 --- a/app/static/css/nopaque.css +++ b/app/static/css/nopaque.css @@ -74,6 +74,9 @@ indicator will show up how the column is sorted right now.; */ } /* styles for resource lists */ +.analyse-link[href=""] { + display: none; +} .service[data-service]:before { content: "help"; } diff --git a/app/static/js/nopaque.lists.js b/app/static/js/nopaque.lists.js index 8cfda3c9..d8861bbe 100644 --- a/app/static/js/nopaque.lists.js +++ b/app/static/js/nopaque.lists.js @@ -56,7 +56,7 @@ RessourceList.dataMapper = { corpus: corpus => ({creation_date: corpus.creation_date, description: corpus.description, id: corpus.id, - "analyse-link": `/corpora/${corpus.id}/analyse`, + "analyse-link": ["analysing", "prepared", "start analysis"].includes(corpus.status) ? `/corpora/${corpus.id}/analyse` : "", "edit-link": `/corpora/${corpus.id}`, status: corpus.status, title: corpus.title}),