(Public-)Corpus List fix+highligting owner status

This commit is contained in:
Inga Kirschnick
2023-05-05 08:41:14 +02:00
parent 8a85dd9e61
commit b07addc5c3
9 changed files with 51 additions and 58 deletions

View File

@ -16,15 +16,6 @@ class CorpusList extends ResourceList {
if (this.isInitialized) {this.onPatch(patch);}
});
});
app.getUser(this.userId).then((user) => {
let followedCorpora = [];
for (let cfa of Object.values(user.corpus_follower_associations)) {
followedCorpora.push(cfa.corpus);
}
this.add(Object.values(user.corpora));
this.add(followedCorpora);
this.isInitialized = true;
});
}
// #region Mandatory getters and methods to implement
@ -33,6 +24,7 @@ class CorpusList extends ResourceList {
<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="owner"></span></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 red waves-effect waves-light" data-list-action="delete-request"><i class="material-icons">delete</i></a>
@ -48,7 +40,9 @@ class CorpusList extends ResourceList {
{data: ['creation-date']},
{name: 'status', attr: 'data-status'},
'description',
'title'
'title',
'owner',
{data: ['is-owner']}
];
}
@ -68,6 +62,7 @@ class CorpusList extends ResourceList {
<tr>
<th></th>
<th>Title and Description</th>
<th>Owner</th>
<th>Status</th>
<th></th>
</tr>
@ -84,7 +79,9 @@ class CorpusList extends ResourceList {
'creation-date': corpus.creation_date,
'description': corpus.description,
'status': corpus.status,
'title': corpus.title
'title': corpus.title,
'owner': corpus.user.username,
'is-owner': corpus.user.id === currentUserId ? true : false
};
}

View File

@ -1,14 +0,0 @@
class FollowedCorpusList 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

@ -4,6 +4,7 @@ class PublicCorpusList extends CorpusList {
<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="owner"></span></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>