From e03b54cfcd3e03bae1d940fcc674294393b6b4d1 Mon Sep 17 00:00:00 2001 From: Inga Kirschnick <inga.kirschnick@uni-bielefeld.de> Date: Thu, 9 Feb 2023 14:03:03 +0100 Subject: [PATCH] update public corpora list on dashboard --- app/corpora/routes.py | 2 +- app/static/js/ResourceLists/PublicCorpusList.js | 14 ++++++++++++++ app/templates/_scripts.html.j2 | 1 + app/templates/main/dashboard.html.j2 | 2 +- 4 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 app/static/js/ResourceLists/PublicCorpusList.js diff --git a/app/corpora/routes.py b/app/corpora/routes.py index 0312bf4c..f2cbac63 100644 --- a/app/corpora/routes.py +++ b/app/corpora/routes.py @@ -72,7 +72,7 @@ def corpus(corpus_id): db.session.commit() flash('Your changes have been saved') return redirect(url_for('.corpus', corpus_id=corpus.id)) - if corpus.user == current_user or current_user.is_administrator(): + if corpus.user == current_user: return render_template( 'corpora/corpus.html.j2', corpus_settings_form=corpus_settings_form, diff --git a/app/static/js/ResourceLists/PublicCorpusList.js b/app/static/js/ResourceLists/PublicCorpusList.js new file mode 100644 index 00000000..fdb2e9ed --- /dev/null +++ b/app/static/js/ResourceLists/PublicCorpusList.js @@ -0,0 +1,14 @@ +class PublicCorpusList extends CorpusList { + get item() { + return ` + <tr class="list-item clickable hoverable"> + <td><a class="btn-floating disabled"><i class="material-icons service-color darken" data-service="corpus-analysis">book</i></a></td> + <td><b class="title"></b><br><i class="description"></i></td> + <td><span class="status badge new corpus-status-color corpus-status-text" data-badge-caption=""></span></td> + <td class="right-align"> + <a class="list-action-trigger btn-floating service-color darken waves-effect waves-light" data-list-action="view" data-service="corpus-analysis"><i class="material-icons">send</i></a> + </td> + </tr> + `.trim(); + } +} diff --git a/app/templates/_scripts.html.j2 b/app/templates/_scripts.html.j2 index 64629b6c..53a0469c 100644 --- a/app/templates/_scripts.html.j2 +++ b/app/templates/_scripts.html.j2 @@ -22,6 +22,7 @@ 'js/ResourceLists/CorpusFileList.js', 'js/ResourceLists/PublicCorpusFileList.js', 'js/ResourceLists/CorpusList.js', + 'js/ResourceLists/PublicCorpusList.js', 'js/ResourceLists/JobList.js', 'js/ResourceLists/JobInputList.js', 'js/ResourceLists/JobResultList.js', diff --git a/app/templates/main/dashboard.html.j2 b/app/templates/main/dashboard.html.j2 index 5391a8af..0feba7b5 100644 --- a/app/templates/main/dashboard.html.j2 +++ b/app/templates/main/dashboard.html.j2 @@ -119,7 +119,7 @@ <script> let userList = new UserList(document.querySelector('.user-list')); userList.add({{ users|tojson }}); - let publicCorpusList = new CorpusList(document.querySelector('.public-corpus-list')); + let publicCorpusList = new PublicCorpusList(document.querySelector('.public-corpus-list')); publicCorpusList.add({{ corpora|tojson }}); </script> {% endblock scripts %} -- GitLab