distinct style for rows of banned users in listing, saving space

This commit is contained in:
Rigel Kent 2020-07-01 12:09:23 +02:00
parent 4dcaa2d797
commit 9b01cfc788
No known key found for this signature in database
GPG Key ID: 5E53E96A494E452F
3 changed files with 14 additions and 5 deletions

View File

@ -14,6 +14,7 @@
[showCurrentPageReport]="true" i18n-currentPageReportTemplate [showCurrentPageReport]="true" i18n-currentPageReportTemplate
currentPageReportTemplate="Showing {{'{first}'}} to {{'{last}'}} of {{'{totalRecords}'}} users" currentPageReportTemplate="Showing {{'{first}'}} to {{'{last}'}} of {{'{totalRecords}'}} users"
(onPage)="onPage($event)" [expandedRowKeys]="expandedRows" (onPage)="onPage($event)" [expandedRowKeys]="expandedRows"
[rowStyleClass]="getRowClasses"
> >
<ng-template pTemplate="caption"> <ng-template pTemplate="caption">
<div class="caption"> <div class="caption">
@ -48,7 +49,7 @@
<th style="width: 120px;" i18n>Role</th> <th style="width: 120px;" i18n>Role</th>
<th style="width: 140px;" pResizableColumn i18n>Auth plugin</th> <th style="width: 140px;" pResizableColumn i18n>Auth plugin</th>
<th style="width: 150px;" i18n pSortableColumn="createdAt">Created <p-sortIcon field="createdAt"></p-sortIcon></th> <th style="width: 150px;" i18n pSortableColumn="createdAt">Created <p-sortIcon field="createdAt"></p-sortIcon></th>
<th style="width: 50px;"></th> <th style="width: 60px;"></th>
</tr> </tr>
</ng-template> </ng-template>
@ -75,11 +76,13 @@
alt="Avatar" alt="Avatar"
> >
<div> <div>
<span>
<span *ngIf="user.blocked" i18n-title title="The user was banned" class="glyphicon glyphicon-ban-circle"></span>
{{ user.account.displayName }} {{ user.account.displayName }}
</span>
<span class="text-muted">{{ user.username }}</span> <span class="text-muted">{{ user.username }}</span>
</div> </div>
</div> </div>
<span i18n *ngIf="user.blocked" class="banned-info">(banned)</span>
</a> </a>
</td> </td>

View File

@ -5,8 +5,8 @@
@include create-button; @include create-button;
} }
tr.banned { tr.banned > td {
color: red; background-color: lighten($color: $red, $amount: 40) !important;
} }
.banned-info { .banned-info {

View File

@ -87,6 +87,12 @@ export class UserListComponent extends RestTable implements OnInit {
return 'UserListComponent' return 'UserListComponent'
} }
getRowClasses (rowData: User) {
return {
banned: rowData.blocked
}
}
openBanUserModal (users: User[]) { openBanUserModal (users: User[]) {
for (const user of users) { for (const user of users) {
if (user.username === 'root') { if (user.username === 'root') {