Skip to content
Snippets Groups Projects
Commit 54f7f824 authored by Alex ORLUC's avatar Alex ORLUC
Browse files

FEAT #13271 TIME 1:30 add show more / less

parent f3f82837
No related branches found
No related tags found
No related merge requests found
...@@ -7,8 +7,11 @@ ...@@ -7,8 +7,11 @@
<mat-selection-list #filterList *ngFor="let filterKey of filters | keyvalue" class="filter-list"> <mat-selection-list #filterList *ngFor="let filterKey of filters | keyvalue" class="filter-list">
<div class="catGroupTitle">{{'lang.'+filterKey.key | translate}} ({{filters[filterKey.key].length}})</div> <div class="catGroupTitle">{{'lang.'+filterKey.key | translate}} ({{filters[filterKey.key].length}})</div>
<mat-divider style="width: 80%;"></mat-divider> <mat-divider style="width: 80%;"></mat-divider>
<mat-list-option color="primary" class="catContent" *ngFor="let cat of filters[filterKey.key];let i=index" (click)="toggleFilter(filterKey.key,i)" [selected]="cat.selected" checkboxPosition="before" [disabled]="isLoadingResults"> <ng-container *ngFor="let cat of filters[filterKey.key];let i=index">
<span class="catLabel" [title]="cat.label">{{cat.id !== null ? cat.label : 'lang.undefined' | translate}}</span><span class="catBadge">{{cat.count}}</span> <mat-list-option color="primary" class="catContent" *ngIf="i <= 5 || showMore[filterKey.key]" (click)="toggleFilter(filterKey.key,i)" [selected]="cat.selected" checkboxPosition="before" [disabled]="isLoadingResults">
</mat-list-option> <span class="catLabel" [title]="cat.label">{{cat.id !== null ? cat.label : 'lang.undefined' | translate}}</span><span class="catBadge">{{cat.count}}</span>
</mat-list-option>
</ng-container>
<button mat-button *ngIf="filters[filterKey.key].length > 5" style="width:100%;" color="primary" (click)="toggleDisplay(filterKey.key)">{{showMore[filterKey.key] ? ('lang.less' | translate) : ('lang.more' | translate) }}<mat-icon style="height:auto;" class="fas" [class.fa-chevron-down]="!showMore[filterKey.key]" [class.fa-chevron-up]="showMore[filterKey.key]"></mat-icon></button>
</mat-selection-list> </mat-selection-list>
</mat-expansion-panel> </mat-expansion-panel>
...@@ -14,6 +14,8 @@ export class FilterToolComponent implements OnInit { ...@@ -14,6 +14,8 @@ export class FilterToolComponent implements OnInit {
@Input() filters: any = {}; @Input() filters: any = {};
@Input() isLoadingResults: boolean = false; @Input() isLoadingResults: boolean = false;
showMore = {};
@Output() filterChanged = new EventEmitter<any>(); @Output() filterChanged = new EventEmitter<any>();
constructor( constructor(
...@@ -33,4 +35,8 @@ export class FilterToolComponent implements OnInit { ...@@ -33,4 +35,8 @@ export class FilterToolComponent implements OnInit {
this.filters[key][index].selected = !this.filters[key][index].selected; this.filters[key][index].selected = !this.filters[key][index].selected;
this.filterChanged.emit(); this.filterChanged.emit();
} }
toggleDisplay(key: string) {
this.showMore[key] = !this.showMore[key];
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment