update public corpora list on dashboard

This commit is contained in:
Inga Kirschnick 2023-02-09 14:03:03 +01:00
parent 91a800f7fd
commit e03b54cfcd
4 changed files with 17 additions and 2 deletions

View File

@ -72,7 +72,7 @@ def corpus(corpus_id):
db.session.commit() db.session.commit()
flash('Your changes have been saved') flash('Your changes have been saved')
return redirect(url_for('.corpus', corpus_id=corpus.id)) 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( return render_template(
'corpora/corpus.html.j2', 'corpora/corpus.html.j2',
corpus_settings_form=corpus_settings_form, corpus_settings_form=corpus_settings_form,

View File

@ -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();
}
}

View File

@ -22,6 +22,7 @@
'js/ResourceLists/CorpusFileList.js', 'js/ResourceLists/CorpusFileList.js',
'js/ResourceLists/PublicCorpusFileList.js', 'js/ResourceLists/PublicCorpusFileList.js',
'js/ResourceLists/CorpusList.js', 'js/ResourceLists/CorpusList.js',
'js/ResourceLists/PublicCorpusList.js',
'js/ResourceLists/JobList.js', 'js/ResourceLists/JobList.js',
'js/ResourceLists/JobInputList.js', 'js/ResourceLists/JobInputList.js',
'js/ResourceLists/JobResultList.js', 'js/ResourceLists/JobResultList.js',

View File

@ -119,7 +119,7 @@
<script> <script>
let userList = new UserList(document.querySelector('.user-list')); let userList = new UserList(document.querySelector('.user-list'));
userList.add({{ users|tojson }}); 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 }}); publicCorpusList.add({{ corpora|tojson }});
</script> </script>
{% endblock scripts %} {% endblock scripts %}