From 17e5d42d17e67a22c24574a6cd49045f5b0b30aa Mon Sep 17 00:00:00 2001 From: Sean Date: Thu, 5 Nov 2020 13:40:18 +0100 Subject: [PATCH] Show vote weight totals in user list Shows the total vote weight in user list --- .../list-view-table/list-view-table.component.html | 3 +++ .../sort-filter-bar/sort-filter-bar.component.html | 4 ++-- .../sort-filter-bar/sort-filter-bar.component.scss | 4 +++- .../components/sort-filter-bar/sort-filter-bar.component.ts | 6 ------ .../users/components/user-list/user-list.component.html | 5 +++++ .../site/users/components/user-list/user-list.component.ts | 5 +++++ client/src/styles.scss | 1 - 7 files changed, 18 insertions(+), 10 deletions(-) diff --git a/client/src/app/shared/components/list-view-table/list-view-table.component.html b/client/src/app/shared/components/list-view-table/list-view-table.component.html index 1df325bb2..c7142eb44 100644 --- a/client/src/app/shared/components/list-view-table/list-view-table.component.html +++ b/client/src/app/shared/components/list-view-table/list-view-table.component.html @@ -10,6 +10,9 @@ [searchFieldInput]="inputValue" (searchFieldChange)="searchFilter($event)" > +
+ +
-
+
{{ filterCount }} {{ 'of' | translate }}  {{ totalCount }} -  ยท {{ extraItemInfo }} +
diff --git a/client/src/app/shared/components/sort-filter-bar/sort-filter-bar.component.scss b/client/src/app/shared/components/sort-filter-bar/sort-filter-bar.component.scss index d326d5fb8..a03a1c488 100644 --- a/client/src/app/shared/components/sort-filter-bar/sort-filter-bar.component.scss +++ b/client/src/app/shared/components/sort-filter-bar/sort-filter-bar.component.scss @@ -32,9 +32,11 @@ span.right-with-margin { } .filter-count { + display: flex; + min-width: fit-content; font-style: italic; margin-left: 24px; - margin-right: 5px; + margin-right: 1em; } .current-filters { diff --git a/client/src/app/shared/components/sort-filter-bar/sort-filter-bar.component.ts b/client/src/app/shared/components/sort-filter-bar/sort-filter-bar.component.ts index ab04ca982..ef5b814bb 100644 --- a/client/src/app/shared/components/sort-filter-bar/sort-filter-bar.component.ts +++ b/client/src/app/shared/components/sort-filter-bar/sort-filter-bar.component.ts @@ -55,12 +55,6 @@ export class SortFilterBarComponent { @Input() public filterService: BaseFilterListService; - /** - * 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, * if no filter service is given. diff --git a/client/src/app/site/users/components/user-list/user-list.component.html b/client/src/app/site/users/components/user-list/user-list.component.html index 35b5c639f..a58f92edf 100644 --- a/client/src/app/site/users/components/user-list/user-list.component.html +++ b/client/src/app/site/users/components/user-list/user-list.component.html @@ -29,6 +29,11 @@ [(selectedRows)]="selectedRows" (dataSourceChange)="onDataSourceChange($event)" > + +
+  ({{ 'Vote weight' | translate }} {{ totalVoteWeight }}) +
+
diff --git a/client/src/app/site/users/components/user-list/user-list.component.ts b/client/src/app/site/users/components/user-list/user-list.component.ts index 73b6e71c8..ff9befaec 100644 --- a/client/src/app/site/users/components/user-list/user-list.component.ts +++ b/client/src/app/site/users/components/user-list/user-list.component.ts @@ -122,6 +122,11 @@ export class UserListComponent extends BaseListViewComponent implement 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 */ diff --git a/client/src/styles.scss b/client/src/styles.scss index 666823d4d..00598b229 100644 --- a/client/src/styles.scss +++ b/client/src/styles.scss @@ -274,7 +274,6 @@ b, width: 100%; height: 64px; line-height: 64px; - text-align: right; border-bottom: 1px solid rgba(0, 0, 0, 0.12); display: flex;