|
1 | | -<ng-container *ngIf="(corpora$ | async) as corpora; else loading;"> |
2 | | - <table class="table is-fullwidth is-hoverable" *ngIf="corpora.length > 0"> |
3 | | - <thead> |
| 1 | +<ng-container *ngIf="corpora$ | async as corpora; else loading"> |
| 2 | + <p-table [value]="corpora" [rowHover]="true" sortField="date_added" [sortOrder]="-1"> |
| 3 | + <ng-template pTemplate="header"> |
4 | 4 | <tr> |
5 | | - <th>Name</th> |
6 | | - <th>transcripts (#)</th> |
7 | | - <th *ngIf="(authService.currentUser$ | async).isAdmin">Owner</th> |
| 5 | + <th pSortableColumn="name">Name <p-sortIcon field="name" /></th> |
| 6 | + <th pSortableColumn="num_transcripts"> |
| 7 | + Transcripts (#) <p-sortIcon field="num_transcripts" /> |
| 8 | + </th> |
| 9 | + <th |
| 10 | + pSortableColumn="username" |
| 11 | + *ngIf="(authService.currentUser$ | async).isAdmin" |
| 12 | + > |
| 13 | + Owner <p-sortIcon field="username" /> |
| 14 | + </th> |
| 15 | + <th pSortableColumn="date_added">Created on<p-sortIcon field="date_added" /></th> |
8 | 16 | <th class="has-text-right">Actions</th> |
9 | 17 | </tr> |
10 | | - </thead> |
11 | | - <tbody> |
12 | | - <tr *ngFor="let corp of corpora" [routerLink]="['/corpora/', corp.id]"> |
13 | | - <td>{{ corp.name }}</td> |
14 | | - <td>{{ corp.num_transcripts|| "0" }}</td> |
15 | | - <td *ngIf="(authService.currentUser$ | async).isAdmin">{{corp.username}}</td> |
| 18 | + </ng-template> |
| 19 | + <ng-template pTemplate="body" let-corpus> |
| 20 | + <tr [routerLink]="['/corpora/', corpus.id]"> |
| 21 | + <td>{{ corpus.name }}</td> |
| 22 | + <td>{{ corpus.num_transcripts || "0" }}</td> |
| 23 | + <td *ngIf="(authService.currentUser$ | async).isAdmin"> |
| 24 | + {{ corpus.username }} |
| 25 | + </td> |
| 26 | + <td>{{ corpus.date_added | date: "dd/MM/yyyy" }}</td> |
16 | 27 | <td class="has-text-right"> |
17 | 28 | <div class="buttons is-right"> |
18 | 29 | <button class="button is-success" pTooltip="add transcripts" (click)="$event.stopPropagation()" |
19 | | - [routerLink]="['/upload']" [queryParams]="{ corpus: corp.id }"> |
| 30 | + [routerLink]="['/upload']" [queryParams]="{ corpus: corpus.id }"> |
20 | 31 | <span class="icon is-small"> |
21 | 32 | <fa-icon [icon]="faPlus"></fa-icon> |
22 | 33 | </span> |
23 | 34 | </button> |
24 | 35 | <button class="button is-danger" pTooltip="delete corpus" |
25 | | - (click)="confirmDeleteCorpus($event, corp)"> |
| 36 | + (click)="confirmDeleteCorpus($event, corpus)"> |
26 | 37 | <span class="icon is-small"> |
27 | 38 | <fa-icon [icon]="faTrash"></fa-icon> |
28 | 39 | </span> |
29 | 40 | </button> |
30 | 41 | </div> |
31 | 42 | </td> |
32 | 43 | </tr> |
33 | | - </tbody> |
34 | | - </table> |
| 44 | + </ng-template> |
| 45 | + </p-table> |
35 | 46 |
|
36 | 47 | <h1 *ngIf="corpora.length === 0" class="title is-2"> |
37 | 48 | No corpora yet! |
|
0 commit comments