Fix corpus follower on user page + optgroup models

This commit is contained in:
Inga Kirschnick
2023-05-31 16:10:05 +02:00
parent fab259522e
commit 367c2ce5e0
7 changed files with 53 additions and 13 deletions

View File

@ -85,7 +85,13 @@
for (let optionElement of document.querySelectorAll('option[value=""]')) {
optionElement.disabled = true;
}
for (let optgroupElement of document.querySelectorAll('optgroup[label=""]')) {
for (let c of optgroupElement.children) {
optgroupElement.parentElement.insertAdjacentElement('afterbegin', c);
}
optgroupElement.remove();
}
// Set the data-length attribute on textareas/inputs with the maxlength attribute
for (let inputElement of document.querySelectorAll('textarea[maxlength], input[maxlength]')) {
inputElement.dataset.length = inputElement.getAttribute('maxlength');

View File

@ -8,6 +8,9 @@
<div class="row">
<div class="col s12">
<h1>{{ corpus.title }}</h1>
{% for cfa in cfas %}
{{ cfa.follower.username|tojson }},
{% endfor %}
</div>
<div class="col s12 l7">
<div class="card service-color-border border-darken" data-service="corpus-analysis" style="border-top: 10px solid">

View File

@ -126,7 +126,7 @@ let followedCorpusList = new PublicCorpusList(document.querySelector('.followed-
followedCorpusList.add(
[
{% for corpus in user.followed_corpora %}
{% if (corpus.is_public or corpus.user == current_user) %}
{% if (corpus.is_public or corpus.user == current_user or user == current_user or current_user.is_following_corpus(corpus)) %}
{{ corpus.to_json_serializeable(backrefs=True)|tojson }},
{% endif %}
{% endfor %}