From 5106b9dc7163f2a743e4da01b387344d1fa2002d Mon Sep 17 00:00:00 2001 From: GabrielMeyer Date: Wed, 14 Aug 2019 11:36:30 +0200 Subject: [PATCH] Improves the layout of motion-block-list - Full size - Adds the `sort-filter-bar.component`. - `sort-filter-bar.component` displays the current and total count of filtered items by default, now. --- .../ui-services/base-sort-list.service.ts | 2 +- .../list-view-table.component.html | 1 + .../list-view-table.component.ts | 7 ++ .../sort-filter-bar.component.html | 4 +- .../sort-filter-bar.component.ts | 21 +++--- .../motion-block-list.component.html | 67 +++++++++++-------- .../motion-block-list.component.ts | 9 +++ .../services/motion-block-sort.service.ts | 13 +++- .../tag-list/tag-list.component.html | 10 +-- .../components/tag-list/tag-list.component.ts | 2 +- 10 files changed, 85 insertions(+), 51 deletions(-) diff --git a/client/src/app/core/ui-services/base-sort-list.service.ts b/client/src/app/core/ui-services/base-sort-list.service.ts index 44ba32b59..9dda0c490 100644 --- a/client/src/app/core/ui-services/base-sort-list.service.ts +++ b/client/src/app/core/ui-services/base-sort-list.service.ts @@ -187,7 +187,7 @@ export abstract class BaseSortListService { if (this.sortProperty !== option.property) { return ''; } - return this.ascending ? 'arrow_downward' : 'arrow_upward'; + return this.ascending ? 'arrow_upward' : 'arrow_downward'; } /** 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 87a3165b4..5a5c67893 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 @@ -1,6 +1,7 @@ -
- {{ displayedCount }} of +
+ {{ filterCount }} of  {{ totalCount }}  ยท {{ extraItemInfo }}
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 19bb28a8c..0a5092b14 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 @@ -94,16 +94,9 @@ export class SortFilterBarComponent { private _showFilterSort = true; /** - * Return the amount of data passing filters. Priorizes the override in {@link filterCount} over - * the information from the filterService + * Holds the total amount of data. */ - public get displayedCount(): number { - if (this.filterCount === undefined || this.filterCount === null) { - return this.filterService.filteredCount; - } else { - return this.filterCount; - } - } + private _totalCount: number; /** * Setter for `showFilterSort` @@ -120,11 +113,19 @@ export class SortFilterBarComponent { return this._showFilterSort; } + /** + * Overwrites the total-count. If there is no filter-service set, this is used by default. + */ + @Input() + public set totalCount(count: number) { + this._totalCount = count; + } + /** * Return the total count of potential filters */ public get totalCount(): number { - return this.filterService.unfilteredCount; + return this.filterService ? this.filterService.unfilteredCount : this._totalCount; } public get sortOptions(): any { diff --git a/client/src/app/site/motions/modules/motion-block/components/motion-block-list/motion-block-list.component.html b/client/src/app/site/motions/modules/motion-block/components/motion-block-list/motion-block-list.component.html index 2d04cf7f2..39cd886d7 100644 --- a/client/src/app/site/motions/modules/motion-block/components/motion-block-list/motion-block-list.component.html +++ b/client/src/app/site/motions/modules/motion-block/components/motion-block-list/motion-block-list.component.html @@ -3,37 +3,46 @@

Motion blocks

- - - -
- -
- lock - {{ title }} -
+ + +
+ +
+ lock + {{ title }}
+
- -
- {{ motionBlock.motions.length }} -
-
- + +
+ {{ block.motions.length }} +
+ + +
+ +
+ diff --git a/client/src/app/site/motions/modules/motion-block/components/motion-block-list/motion-block-list.component.ts b/client/src/app/site/motions/modules/motion-block/components/motion-block-list/motion-block-list.component.ts index c5a651952..b14c1117f 100644 --- a/client/src/app/site/motions/modules/motion-block/components/motion-block-list/motion-block-list.component.ts +++ b/client/src/app/site/motions/modules/motion-block/components/motion-block-list/motion-block-list.component.ts @@ -46,6 +46,11 @@ export class MotionBlockListComponent extends BaseListViewComponent { - public sortOptions: OsSortingOption[] = [{ property: 'title' }]; + public sortOptions: OsSortingOption[] = [ + { property: 'title' }, + { + property: 'motions', + label: 'Amount of motions', + sortFn: (aBlock, bBlock, ascending) => { + return ascending + ? aBlock.motions.length - bBlock.motions.length + : bBlock.motions.length - aBlock.motions.length; + } + } + ]; public constructor(translate: TranslateService, store: StorageService, OSStatus: OpenSlidesStatusService) { super('Motion block', translate, store, OSStatus); diff --git a/client/src/app/site/tags/components/tag-list/tag-list.component.html b/client/src/app/site/tags/components/tag-list/tag-list.component.html index 740d706ed..070801044 100644 --- a/client/src/app/site/tags/components/tag-list/tag-list.component.html +++ b/client/src/app/site/tags/components/tag-list/tag-list.component.html @@ -1,9 +1,4 @@ - +

Tags

@@ -13,6 +8,7 @@ [allowProjector]="false" [(selectedRows)]="selectedRows" (dataSourceChange)="onDataSourceChange($event)" + [filterProps]="['name']" >
@@ -43,7 +39,7 @@
- +
diff --git a/client/src/app/site/tags/components/tag-list/tag-list.component.ts b/client/src/app/site/tags/components/tag-list/tag-list.component.ts index 38da6f29a..e2f413229 100644 --- a/client/src/app/site/tags/components/tag-list/tag-list.component.ts +++ b/client/src/app/site/tags/components/tag-list/tag-list.component.ts @@ -30,7 +30,7 @@ export class TagListComponent extends BaseListViewComponent implements @ViewChild('tagDialog', { static: true }) private tagDialog: TemplateRef; - private tagForm: FormGroup = this.formBuilder.group({ + public tagForm: FormGroup = this.formBuilder.group({ name: ['', [Validators.required]] });