Admin page Corpus List fix

This commit is contained in:
Inga Kirschnick 2023-06-07 11:23:59 +02:00
parent a54ff2e35a
commit 8aeafc33bd
3 changed files with 15 additions and 3 deletions

View File

@ -52,10 +52,12 @@ def users():
@register_breadcrumb(bp, '.users.entity', '', dynamic_list_constructor=user_dlc)
def user(user_id):
user = User.query.get_or_404(user_id)
corpora = Corpus.query.filter(Corpus.user == user).all()
return render_template(
'admin/user.html.j2',
title=user.username,
user=user
user=user,
corpora=corpora
)

View File

@ -21,7 +21,7 @@
corpusList.add(
[
{% for corpus in corpora %}
{{ corpus.to_json_serializeable(backrefs=True)|tojson }},
{{ corpus.to_json_serializeable(backrefs=True,relationships=True)|tojson }},
{% endfor %}
]
);

View File

@ -56,7 +56,7 @@
<div class="col s12" id="user-corpora">
<div class="card">
<div class="card-content">
<div class="corpus-list" data-user-id="{{ user.hashid }}"></div>
<div class="corpus-list no-autoinit" data-user-id="{{ user.hashid }}"></div>
</div>
</div>
</div>
@ -107,6 +107,16 @@
{% block scripts %}
{{ super() }}
<script>
let corpusList = new CorpusList(document.querySelector('.corpus-list'));
corpusList.add(
[
{% for corpus in corpora %}
{{ corpus.to_json_serializeable(backrefs=True, relationships=True)|tojson }},
{% endfor %}
]
);
let userRoleChip = document.querySelector('#user-role-chip');
let userRoleChipTooltip = M.Tooltip.init(
userRoleChip,