Compare commits

..

No commits in common. "e93449ba731e0715429f1252978611babb10bf7e" and "c2a6b9d7465981ce815366375dfe7e34077953f3" have entirely different histories.

13 changed files with 124 additions and 223 deletions

View File

@ -12,65 +12,65 @@ from ..decorators import corpus_follower_permission_required
from . import bp from . import bp
@bp.route('/<hashid:corpus_id>/followers', methods=['POST']) # @bp.route('/<hashid:corpus_id>/followers', methods=['POST'])
@corpus_follower_permission_required('MANAGE_FOLLOWERS') # @corpus_follower_permission_required('MANAGE_FOLLOWERS')
@content_negotiation(consumes='application/json', produces='application/json') # @content_negotiation(consumes='application/json', produces='application/json')
def create_corpus_followers(corpus_id): # def create_corpus_followers(corpus_id):
usernames = request.json # usernames = request.json
if not (isinstance(usernames, list) or all(isinstance(u, str) for u in usernames)): # if not (isinstance(usernames, list) or all(isinstance(u, str) for u in usernames)):
abort(400) # abort(400)
corpus = Corpus.query.get_or_404(corpus_id) # corpus = Corpus.query.get_or_404(corpus_id)
for username in usernames: # for username in usernames:
user = User.query.filter_by(username=username, is_public=True).first_or_404() # user = User.query.filter_by(username=username, is_public=True).first_or_404()
user.follow_corpus(corpus) # user.follow_corpus(corpus)
db.session.commit() # db.session.commit()
response_data = { # response_data = {
'message': f'Users are now following "{corpus.title}"', # 'message': f'Users are now following "{corpus.title}"',
'category': 'corpus' # 'category': 'corpus'
} # }
return response_data, 200 # return response_data, 200
@bp.route('/<hashid:corpus_id>/followers/<hashid:follower_id>/role', methods=['PUT']) # @bp.route('/<hashid:corpus_id>/followers/<hashid:follower_id>/role', methods=['PUT'])
@corpus_follower_permission_required('MANAGE_FOLLOWERS') # @corpus_follower_permission_required('MANAGE_FOLLOWERS')
@content_negotiation(consumes='application/json', produces='application/json') # @content_negotiation(consumes='application/json', produces='application/json')
def update_corpus_follower_role(corpus_id, follower_id): # def update_corpus_follower_role(corpus_id, follower_id):
role_name = request.json # role_name = request.json
if not isinstance(role_name, str): # if not isinstance(role_name, str):
abort(400) # abort(400)
cfr = CorpusFollowerRole.query.filter_by(name=role_name).first() # cfr = CorpusFollowerRole.query.filter_by(name=role_name).first()
if cfr is None: # if cfr is None:
abort(400) # abort(400)
cfa = CorpusFollowerAssociation.query.filter_by(corpus_id=corpus_id, follower_id=follower_id).first_or_404() # cfa = CorpusFollowerAssociation.query.filter_by(corpus_id=corpus_id, follower_id=follower_id).first_or_404()
cfa.role = cfr # cfa.role = cfr
db.session.commit() # db.session.commit()
response_data = { # response_data = {
'message': f'User "{cfa.follower.username}" is now {cfa.role.name}', # 'message': f'User "{cfa.follower.username}" is now {cfa.role.name}',
'category': 'corpus' # 'category': 'corpus'
} # }
return response_data, 200 # return response_data, 200
@bp.route('/<hashid:corpus_id>/followers/<hashid:follower_id>', methods=['DELETE']) # @bp.route('/<hashid:corpus_id>/followers/<hashid:follower_id>', methods=['DELETE'])
def delete_corpus_follower(corpus_id, follower_id): # def delete_corpus_follower(corpus_id, follower_id):
cfa = CorpusFollowerAssociation.query.filter_by(corpus_id=corpus_id, follower_id=follower_id).first_or_404() # cfa = CorpusFollowerAssociation.query.filter_by(corpus_id=corpus_id, follower_id=follower_id).first_or_404()
if not ( # if not (
current_user.id == follower_id # current_user.id == follower_id
or current_user == cfa.corpus.user # or current_user == cfa.corpus.user
or CorpusFollowerAssociation.query.filter_by(corpus_id=corpus_id, follower_id=current_user.id).first().role.has_permission('MANAGE_FOLLOWERS') # or CorpusFollowerAssociation.query.filter_by(corpus_id=corpus_id, follower_id=current_user.id).first().role.has_permission('MANAGE_FOLLOWERS')
or current_user.is_administrator()): # or current_user.is_administrator()):
abort(403) # abort(403)
if current_user.id == follower_id: # if current_user.id == follower_id:
flash(f'You are no longer following "{cfa.corpus.title}"', 'corpus') # flash(f'You are no longer following "{cfa.corpus.title}"', 'corpus')
response = make_response() # response = make_response()
response.status_code = 204 # response.status_code = 204
else: # else:
response_data = { # response_data = {
'message': f'"{cfa.follower.username}" is not following "{cfa.corpus.title}" anymore', # 'message': f'"{cfa.follower.username}" is not following "{cfa.corpus.title}" anymore',
'category': 'corpus' # 'category': 'corpus'
} # }
response = jsonify(response_data) # response = jsonify(response_data)
response.status_code = 200 # response.status_code = 200
cfa.follower.unfollow_corpus(cfa.corpus) # cfa.follower.unfollow_corpus(cfa.corpus)
db.session.commit() # db.session.commit()
return response # return response

View File

@ -71,6 +71,7 @@ def corpus(corpus_id):
users = users users = users
) )
if (current_user.is_following_corpus(corpus) or corpus.is_public): if (current_user.is_following_corpus(corpus) or corpus.is_public):
abort(403)
cfas = CorpusFollowerAssociation.query.filter(Corpus.id == corpus_id, CorpusFollowerAssociation.follower_id != corpus.user.id).all() cfas = CorpusFollowerAssociation.query.filter(Corpus.id == corpus_id, CorpusFollowerAssociation.follower_id != corpus.user.id).all()
print(cfas) print(cfas)
return render_template( return render_template(
@ -98,14 +99,14 @@ def analysis(corpus_id):
) )
@bp.route('/<hashid:corpus_id>/follow/<token>') # @bp.route('/<hashid:corpus_id>/follow/<token>')
def follow_corpus(corpus_id, token): # def follow_corpus(corpus_id, token):
corpus = Corpus.query.get_or_404(corpus_id) # corpus = Corpus.query.get_or_404(corpus_id)
if current_user.follow_corpus_by_token(token): # if current_user.follow_corpus_by_token(token):
db.session.commit() # db.session.commit()
flash(f'You are following "{corpus.title}" now', category='corpus') # flash(f'You are following "{corpus.title}" now', category='corpus')
return redirect(url_for('corpora.corpus', corpus_id=corpus_id)) # return redirect(url_for('corpora.corpus', corpus_id=corpus_id))
abort(403) # abort(403)
@bp.route('/import', methods=['GET', 'POST']) @bp.route('/import', methods=['GET', 'POST'])

View File

@ -787,16 +787,10 @@ class User(HashidMixin, UserMixin, db.Model):
#endregion Profile Privacy settings #endregion Profile Privacy settings
def follow_corpus(self, corpus, role=None): def follow_corpus(self, corpus, role=None):
if role is None:
cfr = CorpusFollowerRole.query.filter_by(default=True).first()
else:
cfr = role
if self.is_following_corpus(corpus): if self.is_following_corpus(corpus):
cfa = CorpusFollowerAssociation.query.filter_by(corpus=corpus, follower=self).first() return
if cfa.role != cfr: r = CorpusFollowerRole.query.filter_by(default=True).first() if role is None else role
cfa.role = cfr cfa = CorpusFollowerAssociation(corpus=corpus, role=r, follower=self)
else:
cfa = CorpusFollowerAssociation(corpus=corpus, role=cfr, follower=self)
db.session.add(cfa) db.session.add(cfa)
def unfollow_corpus(self, corpus): def unfollow_corpus(self, corpus):
@ -846,7 +840,7 @@ class User(HashidMixin, UserMixin, db.Model):
if role is None: if role is None:
return False return False
self.follow_corpus(corpus, role) self.follow_corpus(corpus, role)
# db.session.add(self) db.session.add(self)
return True return True
def to_json_serializeable(self, backrefs=False, relationships=False, filter_by_privacy_settings=False): def to_json_serializeable(self, backrefs=False, relationships=False, filter_by_privacy_settings=False):

View File

@ -158,7 +158,7 @@ class CorpusFileList extends ResourceList {
window.location.reload(); window.location.reload();
}); });
} else { } else {
Requests.corpora.entity.files.ent.delete(this.corpusId, itemId) Requests.corpora.entity.followers.entity.delete(this.corpusId, itemId);
} }
}); });
modal.open(); modal.open();

View File

@ -26,9 +26,9 @@ class CorpusList extends ResourceList {
get item() { get item() {
return (values) => { return (values) => {
return ` return `
<tr class="list-item"> <tr class="${values['is-owner'] ? '' : 'deep-purple lighten-5'} list-item">
<td> <td>
<label class="list-action-trigger" data-list-action="select"> <label class="list-action-trigger ${values['is-owner'] ? '' : 'hide'}" data-list-action="select">
<input class="select-checkbox" type="checkbox"> <input class="select-checkbox" type="checkbox">
<span class="disable-on-click"></span> <span class="disable-on-click"></span>
</label> </label>
@ -36,9 +36,8 @@ class CorpusList extends ResourceList {
<td><b class="title"></b><br><i class="description"></i></td> <td><b class="title"></b><br><i class="description"></i></td>
<td><span class="owner"></span></td> <td><span class="owner"></span></td>
<td><span class="status badge new corpus-status-color corpus-status-text" data-badge-caption=""></span></td> <td><span class="status badge new corpus-status-color corpus-status-text" data-badge-caption=""></span></td>
<td>${values['current-user-is-following'] ? '<span><i class="left material-icons">visibility</i>Following</span>' : ''}</td>
<td class="right-align"> <td class="right-align">
<a class="list-action-trigger btn-floating red waves-effect waves-light" data-list-action="delete-request"><i class="material-icons">delete</i></a> <a class="list-action-trigger btn-floating red waves-effect waves-light ${values['is-owner'] ? '' : 'hide'}" data-list-action="delete-request"><i class="material-icons">delete</i></a>
<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> <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> </td>
</tr> </tr>
@ -54,7 +53,6 @@ class CorpusList extends ResourceList {
'description', 'description',
'title', 'title',
'owner', 'owner',
'current-user-is-following'
]; ];
} }
@ -81,7 +79,6 @@ class CorpusList extends ResourceList {
<th>Title and Description</th> <th>Title and Description</th>
<th>Owner</th> <th>Owner</th>
<th>Status</th> <th>Status</th>
<th></th>
<th class="right-align"> <th class="right-align">
<a class="corpus-list-selection-action-trigger btn-floating red waves-effect waves-light hide" data-selection-action="delete"><i class="material-icons">delete</i></a> <a class="corpus-list-selection-action-trigger btn-floating red waves-effect waves-light hide" data-selection-action="delete"><i class="material-icons">delete</i></a>
</th> </th>
@ -101,8 +98,7 @@ class CorpusList extends ResourceList {
'status': corpus.status, 'status': corpus.status,
'title': corpus.title, 'title': corpus.title,
'owner': corpus.user.username, 'owner': corpus.user.username,
'is-owner': corpus.user.id === this.userId ? true : false, 'is-owner': corpus.user.id === this.userId ? true : false
'current-user-is-following': Object.values(corpus.corpus_follower_associations).some(association => association.follower.id === currentUserId)
}; };
} }
@ -124,7 +120,7 @@ class CorpusList extends ResourceList {
<div class="modal"> <div class="modal">
<div class="modal-content"> <div class="modal-content">
<h4>Confirm Corpus deletion</h4> <h4>Confirm Corpus deletion</h4>
<p>Do you really want to ${values['is-owner'] ? 'delete' : 'unfollow'} the Corpus <b>${values.title}</b>? ${values['is-owner'] ? 'All files will be permanently deleted!' : ''}</p> <p>Do you really want to delete the Corpus <b>${values.title}</b>? All files will be permanently deleted!</p>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<a class="btn modal-close waves-effect waves-light">Cancel</a> <a class="btn modal-close waves-effect waves-light">Cancel</a>
@ -146,14 +142,7 @@ class CorpusList extends ResourceList {
); );
let confirmElement = modalElement.querySelector('.action-button[data-action="confirm"]'); let confirmElement = modalElement.querySelector('.action-button[data-action="confirm"]');
confirmElement.addEventListener('click', (event) => { confirmElement.addEventListener('click', (event) => {
if (!values['is-owner']) {
Requests.corpora.entity.followers.entity.delete(itemId, currentUserId)
.then((response) => {
window.location.reload();
});
} else {
Requests.corpora.entity.delete(itemId); Requests.corpora.entity.delete(itemId);
}
}); });
modal.open(); modal.open();
break; break;
@ -163,6 +152,7 @@ class CorpusList extends ResourceList {
break; break;
} }
case 'select': { case 'select': {
if (event.target.checked) { if (event.target.checked) {
this.selectedItemIds.add(itemId); this.selectedItemIds.add(itemId);
} else { } else {
@ -179,7 +169,7 @@ class CorpusList extends ResourceList {
onSelectionAction(event) { onSelectionAction(event) {
let selectionActionElement = event.target.closest('.corpus-list-selection-action-trigger[data-selection-action]'); let selectionActionElement = event.target.closest('.corpus-list-selection-action-trigger[data-selection-action]');
let selectionAction = selectionActionElement.dataset.selectionAction; let selectionAction = selectionActionElement.dataset.selectionAction;
let items = Array.from(this.listjs.items); let items = Array.from(this.listjs.items).filter(item => item._values["is-owner"] === true);
let selectableItems = Array.from(items) let selectableItems = Array.from(items)
.filter(item => item.elm) .filter(item => item.elm)
.map(item => item.elm.querySelector('.select-checkbox[type="checkbox"]')); .map(item => item.elm.querySelector('.select-checkbox[type="checkbox"]'));
@ -205,11 +195,10 @@ class CorpusList extends ResourceList {
` `
<div class="modal"> <div class="modal">
<div class="modal-content"> <div class="modal-content">
<h4>Confirm Corpus deletion</h4> <h4>Confirm Corpus File deletion</h4>
<p>Do you really want to delete this Corpora? <i>All corpora will be permanently deleted!</i></p> <p>Do you really want to delete this Corpora?</p>
<ul id="selected-deletion-items-list"></ul> <ul id="selected-items-list"></ul>
<p>Do you really want to unfollow this Corpora?</p> <p>All corpora will be permanently deleted!</p>
<ul id="selected-unfollow-items-list"></ul>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<a class="btn modal-close waves-effect waves-light">Cancel</a> <a class="btn modal-close waves-effect waves-light">Cancel</a>
@ -219,17 +208,12 @@ class CorpusList extends ResourceList {
` `
); );
document.querySelector('#modals').appendChild(modalElement); document.querySelector('#modals').appendChild(modalElement);
let itemDeletionList = document.querySelector('#selected-deletion-items-list'); let itemList = document.querySelector('#selected-items-list');
let itemUnfollowList = document.querySelector('#selected-unfollow-items-list');
this.selectedItemIds.forEach(selectedItemId => { this.selectedItemIds.forEach(selectedItemId => {
let listItem = this.listjs.get('id', selectedItemId)[0].elm; let listItem = this.listjs.get('id', selectedItemId)[0].elm;
let values = this.listjs.get('id', listItem.dataset.id)[0].values(); let values = this.listjs.get('id', listItem.dataset.id)[0].values();
let itemElement = Utils.HTMLToElement(`<li> - ${values.title}</li>`); let itemElement = Utils.HTMLToElement(`<li> - ${values.title}</li>`);
if (!values['is-owner']) { itemList.appendChild(itemElement);
itemUnfollowList.appendChild(itemElement);
} else {
itemDeletionList.appendChild(itemElement);
}
}); });
let modal = M.Modal.init( let modal = M.Modal.init(
modalElement, modalElement,
@ -244,19 +228,10 @@ class CorpusList extends ResourceList {
let confirmElement = modalElement.querySelector('.action-button[data-action="confirm"]'); let confirmElement = modalElement.querySelector('.action-button[data-action="confirm"]');
confirmElement.addEventListener('click', (event) => { confirmElement.addEventListener('click', (event) => {
this.selectedItemIds.forEach(selectedItemId => { this.selectedItemIds.forEach(selectedItemId => {
let listItem = this.listjs.get('id', selectedItemId)[0].elm;
let values = this.listjs.get('id', listItem.dataset.id)[0].values();
if (!values['is-owner']) {
Requests.corpora.entity.followers.entity.delete(selectedItemId, currentUserId);
} else {
Requests.corpora.entity.delete(selectedItemId); Requests.corpora.entity.delete(selectedItemId);
}
}); });
this.selectedItemIds.clear(); this.selectedItemIds.clear();
this.renderingItemSelection(); this.renderingItemSelection();
setTimeout(() => {
window.location.reload();
}, 1000);
}); });
modal.open(); modal.open();
break; break;
@ -273,6 +248,11 @@ class CorpusList extends ResourceList {
let actionButtons = []; let actionButtons = [];
Object.values(selectableItems).forEach(selectableItem => { Object.values(selectableItems).forEach(selectableItem => {
if (selectableItem._values["is-owner"] === false && this.selectedItemIds.size > 0) {
selectableItem.elm.classList.add('hide');
} else if (selectableItem._values["is-owner"] === false && this.selectedItemIds.size === 0) {
selectableItem.elm.classList.remove('hide');
} else {
if (selectableItem.elm) { if (selectableItem.elm) {
let checkbox = selectableItem.elm.querySelector('.select-checkbox[type="checkbox"]'); let checkbox = selectableItem.elm.querySelector('.select-checkbox[type="checkbox"]');
if (checkbox.checked) { if (checkbox.checked) {
@ -285,6 +265,7 @@ class CorpusList extends ResourceList {
actionButtons.push(itemActionButton); actionButtons.push(itemActionButton);
}); });
} }
}
}); });
// Hide item action buttons if > 0 item is selected and show selection action buttons // Hide item action buttons if > 0 item is selected and show selection action buttons
if (this.selectedItemIds.size > 0) { if (this.selectedItemIds.size > 0) {
@ -304,10 +285,11 @@ class CorpusList extends ResourceList {
} }
// Check select all checkbox if all items are selected // Check select all checkbox if all items are selected
let filteredItems = Object.values(selectableItems).filter(item => item._values["is-owner"] === true)
let selectAllCheckbox = document.querySelector('.corpus-list-select-all-checkbox[type="checkbox"]'); let selectAllCheckbox = document.querySelector('.corpus-list-select-all-checkbox[type="checkbox"]');
if (selectableItems.length === this.selectedItemIds.size && selectAllCheckbox.checked === false) { if (filteredItems.length === this.selectedItemIds.size && selectAllCheckbox.checked === false) {
selectAllCheckbox.checked = true; selectAllCheckbox.checked = true;
} else if (selectableItems.length !== this.selectedItemIds.size && selectAllCheckbox.checked === true) { } else if (filteredItems.length !== this.selectedItemIds.size && selectAllCheckbox.checked === true) {
selectAllCheckbox.checked = false; selectAllCheckbox.checked = false;
} }
} }

View File

@ -1,71 +0,0 @@
class DetailledPublicCorpusList extends CorpusList {
get item() {
return (values) => {
return `
<tr class="list-item clickable hoverable">
<td></td>
<td><b class="title"></b><br><i class="description"></i></td>
<td><span class="owner"></span></td>
<td><span class="status badge new corpus-status-color corpus-status-text" data-badge-caption=""></span></td>
<td>${values['current-user-is-following'] ? '<span><i class="left material-icons">visibility</i>Following</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();
};
}
get valueNames() {
return [
{data: ['id']},
{data: ['creation-date']},
{name: 'status', attr: 'data-status'},
'description',
'title',
'owner',
'current-user-is-following'
];
}
initListContainerElement() {
if (!this.listContainerElement.hasAttribute('id')) {
this.listContainerElement.id = Utils.generateElementId('corpus-list-');
}
let listSearchElementId = Utils.generateElementId(`${this.listContainerElement.id}-search-`);
this.listContainerElement.innerHTML = `
<div class="input-field">
<i class="material-icons prefix">search</i>
<input id="${listSearchElementId}" class="search" type="text"></input>
<label for="${listSearchElementId}">Search Corpus</label>
</div>
<table>
<thead>
<tr>
<th></th>
<th>Title and Description</th>
<th>Owner</th>
<th>Status</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody class="list"></tbody>
</table>
<ul class="pagination"></ul>
`.trim();
}
mapResourceToValue(corpus) {
return {
'id': corpus.id,
'creation-date': corpus.creation_date,
'description': corpus.description,
'status': corpus.status,
'title': corpus.title,
'owner': corpus.user.username,
'is-owner': corpus.user.id === this.userId,
'current-user-is-following': Object.values(corpus.corpus_follower_associations).some(association => association.follower.id === currentUserId)
};
}
}

View File

@ -1,17 +1,14 @@
class PublicCorpusList extends CorpusList { class PublicCorpusList extends CorpusList {
get item() { get item() {
return (values) => {
return ` return `
<tr class="list-item clickable hoverable"> <tr class="list-item clickable hoverable">
<td><b class="title"></b><br><i class="description"></i></td> <td><b class="title"></b><br><i class="description"></i></td>
<td><span class="owner"></span></td> <td><span class="owner"></span></td>
<td>${values['current-user-is-following'] ? '<span><i class="left material-icons">visibility</i></span>' : ''}</td>
<td class="right-align"> <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> <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> </td>
</tr> </tr>
`.trim(); `.trim();
};
} }
initListContainerElement() { initListContainerElement() {
@ -31,7 +28,6 @@ class PublicCorpusList extends CorpusList {
<th>Title and Description</th> <th>Title and Description</th>
<th>Owner</th> <th>Owner</th>
<th></th> <th></th>
<th></th>
</tr> </tr>
</thead> </thead>
<tbody class="list"></tbody> <tbody class="list"></tbody>

View File

@ -48,8 +48,7 @@
'js/ResourceLists/TesseractOCRPipelineModelList.js', 'js/ResourceLists/TesseractOCRPipelineModelList.js',
'js/ResourceLists/UserList.js', 'js/ResourceLists/UserList.js',
'js/ResourceLists/AdminUserList.js', 'js/ResourceLists/AdminUserList.js',
'js/ResourceLists/CorpusFollowerList.js', 'js/ResourceLists/CorpusFollowerList.js'
'js/ResourceLists/DetailledPublicCorpusList.js'
%} %}
<script src="{{ ASSET_URL }}"></script> <script src="{{ ASSET_URL }}"></script>
{%- endassets %} {%- endassets %}

View File

@ -192,7 +192,7 @@
<div class="input-field"> <div class="input-field">
<i class="material-icons prefix">badge</i> <i class="material-icons prefix">badge</i>
<select id="share-link-modal-corpus-follower-role-select"> <select id="share-link-modal-corpus-follower-role-select">
{% for cfr in cfrs if cfr.name != 'Anonymous' %} {% for cfr in cfrs %}
<option value="{{ cfr.name }}">{{ cfr.name }}</option> <option value="{{ cfr.name }}">{{ cfr.name }}</option>
{% endfor %} {% endfor %}
</select> </select>

View File

@ -270,7 +270,7 @@ publicCorpusFollowerList.add(
{% endif %} {% endif %}
// #region Build Corpus Request // #region Build Corpus Request
{% if cfr.has_permission('MANAGE_FILES') %} {% if cfr.has_permission('MANAGE_CORPUS') %}
let followerBuildRequest = document.querySelector('#follower-build-request'); let followerBuildRequest = document.querySelector('#follower-build-request');
followerBuildRequest.addEventListener('click', () => { followerBuildRequest.addEventListener('click', () => {
Requests.corpora.entity.build({{ corpus.hashid|tojson }}) Requests.corpora.entity.build({{ corpus.hashid|tojson }})

View File

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

View File

@ -70,11 +70,11 @@
{% endfor %} {% endfor %}
] ]
); );
let publicCorpusList = new DetailledPublicCorpusList(document.querySelector('.public-corpus-list')); let publicCorpusList = new PublicCorpusList(document.querySelector('.public-corpus-list'));
publicCorpusList.add( publicCorpusList.add(
[ [
{% for corpus in corpora %} {% for corpus in corpora %}
{{ corpus.to_json_serializeable(backrefs=True, relationships=True)|tojson }}, {{ corpus.to_json_serializeable(backrefs=True)|tojson }},
{% endfor %} {% endfor %}
] ]
); );

View File

@ -127,7 +127,7 @@ followedCorpusList.add(
[ [
{% for corpus in user.followed_corpora %} {% for corpus in user.followed_corpora %}
{% if (corpus.is_public or corpus.user == current_user or user == current_user or current_user.is_following_corpus(corpus)) %} {% 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, relationships=True)|tojson }}, {{ corpus.to_json_serializeable(backrefs=True)|tojson }},
{% endif %} {% endif %}
{% endfor %} {% endfor %}
] ]
@ -137,7 +137,7 @@ publicCorpusList.add(
[ [
{% for corpus in user.corpora %} {% for corpus in user.corpora %}
{% if corpus.is_public %} {% if corpus.is_public %}
{{ corpus.to_json_serializeable(backrefs=True, relationships=True)|tojson }}, {{ corpus.to_json_serializeable(backrefs=True)|tojson }},
{% endif %} {% endif %}
{% endfor %} {% endfor %}
] ]