Merge pull request #5676 from tsiegleauq/show-vote-totals-in-user-list

Show vote weight totals in user list
This commit is contained in:
Emanuel Schütze 2020-11-06 11:16:16 +01:00 committed by GitHub
commit 9fcb6cdcba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 18 additions and 10 deletions

View File

@ -10,6 +10,9 @@
[searchFieldInput]="inputValue" [searchFieldInput]="inputValue"
(searchFieldChange)="searchFilter($event)" (searchFieldChange)="searchFilter($event)"
> >
<div class="extra-info-slot">
<ng-content select=".filter-bar-info-slot"></ng-content>
</div>
</os-sort-filter-bar> </os-sort-filter-bar>
<pbl-ngrid <pbl-ngrid

View File

@ -1,9 +1,9 @@
<div class="custom-table-header flex-spaced"> <div class="custom-table-header flex-spaced">
<!-- Amount of filters --> <!-- Amount of filters -->
<div class="filter-count"> <div class="filter-count one-line">
<span>{{ filterCount }}&nbsp;</span><span>{{ 'of' | translate }}</span> <span>{{ filterCount }}&nbsp;</span><span>{{ 'of' | translate }}</span>
<span>&nbsp;{{ totalCount }}</span> <span>&nbsp;{{ totalCount }}</span>
<span *ngIf="extraItemInfo">&nbsp;·&nbsp;{{ extraItemInfo }}</span> <ng-content select=".extra-info-slot"></ng-content>
</div> </div>
<!-- Current filters --> <!-- Current filters -->

View File

@ -32,9 +32,11 @@ span.right-with-margin {
} }
.filter-count { .filter-count {
display: flex;
min-width: fit-content;
font-style: italic; font-style: italic;
margin-left: 24px; margin-left: 24px;
margin-right: 5px; margin-right: 1em;
} }
.current-filters { .current-filters {

View File

@ -55,12 +55,6 @@ export class SortFilterBarComponent<V extends BaseViewModel> {
@Input() @Input()
public filterService: BaseFilterListService<V>; public filterService: BaseFilterListService<V>;
/**
* optional additional string to show after the item count. This string will not be translated here
*/
@Input()
public extraItemInfo: string;
/** /**
* Optional string to tell the verbose name of the filtered items. This string is displayed, * Optional string to tell the verbose name of the filtered items. This string is displayed,
* if no filter service is given. * if no filter service is given.

View File

@ -29,6 +29,11 @@
[(selectedRows)]="selectedRows" [(selectedRows)]="selectedRows"
(dataSourceChange)="onDataSourceChange($event)" (dataSourceChange)="onDataSourceChange($event)"
> >
<!-- extra content in the filter bar -->
<div class="filter-bar-info-slot" *ngIf="showVoteWeight">
&nbsp;<span>({{ 'Vote weight' | translate }} {{ totalVoteWeight }})</span>
</div>
<!-- Name column --> <!-- Name column -->
<div *pblNgridCellDef="'short_name'; row as user; rowContext as rowContext" class="cell-slot fill"> <div *pblNgridCellDef="'short_name'; row as user; rowContext as rowContext" class="cell-slot fill">
<a class="detail-link" [routerLink]="user.id" *ngIf="!isMultiSelect"></a> <a class="detail-link" [routerLink]="user.id" *ngIf="!isMultiSelect"></a>

View File

@ -122,6 +122,11 @@ export class UserListComponent extends BaseListViewComponent<ViewUser> implement
return this.pollService.isElectronicVotingEnabled && this.isVoteWeightActive; return this.pollService.isElectronicVotingEnabled && this.isVoteWeightActive;
} }
public get totalVoteWeight(): number {
const votes = this.dataSource?.filteredData?.reduce((previous, current) => previous + current.vote_weight, 0);
return votes ?? 0;
}
/** /**
* Define the columns to show * Define the columns to show
*/ */

View File

@ -274,7 +274,6 @@ b,
width: 100%; width: 100%;
height: 64px; height: 64px;
line-height: 64px; line-height: 64px;
text-align: right;
border-bottom: 1px solid rgba(0, 0, 0, 0.12); border-bottom: 1px solid rgba(0, 0, 0, 0.12);
display: flex; display: flex;