2018-11-21 16:24:14 +01:00
|
|
|
import {Component, Input, Output, EventEmitter} from '@angular/core';
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'search-sorting',
|
2020-03-13 17:11:36 +01:00
|
|
|
template: `
|
|
|
|
<!-- <span class="uk-grid">-->
|
|
|
|
<!-- <div class=""> Sort by:</div>-->
|
|
|
|
<!-- <div class="uk-width-small">-->
|
|
|
|
<!-- <mat-select *ngIf="(entityType != 'community' && entityType != 'funder' )" -->
|
|
|
|
<!-- class="uk-width-auto uk-text-bold matSelection" -->
|
|
|
|
<!-- id="form-horizontal-select" name="select_results_per_page"-->
|
|
|
|
<!-- [disableOptionCentering]="true"-->
|
|
|
|
<!-- panelClass="matSelectionPanel"-->
|
|
|
|
<!-- [(ngModel)]="sortBy" (ngModelChange)="sortByChanged()">-->
|
|
|
|
<!-- <mat-option value="">Relevance</mat-option>-->
|
|
|
|
<!-- <mat-option value="resultdateofacceptance,descending">Date (most recent)</mat-option>-->
|
|
|
|
<!-- <mat-option value="resultdateofacceptance,ascending">Date (least recent)</mat-option>-->
|
|
|
|
<!-- </mat-select>-->
|
|
|
|
<!-- <mat-select *ngIf="(entityType == 'community' || entityType == 'funder')" -->
|
|
|
|
<!-- class="uk-width-small uk-text-bold matSelection" -->
|
|
|
|
<!-- id="form-horizontal-select" name="select_results_per_page"-->
|
|
|
|
<!-- [(ngModel)]="sortBy" (ngModelChange)="sortByChanged()"-->
|
|
|
|
<!-- [disableOptionCentering]="true"-->
|
|
|
|
<!-- panelClass="matSelectionPanel">-->
|
|
|
|
<!-- <mat-option value="">Title</mat-option>-->
|
|
|
|
<!-- <mat-option value="creationdate,descending">Creation Date (most recent)</mat-option>-->
|
|
|
|
<!-- <mat-option value="creationdate,ascending">Creation Date (least recent)</mat-option>-->
|
|
|
|
<!-- </mat-select>-->
|
|
|
|
<!-- </div>-->
|
|
|
|
<!-- </span>-->
|
|
|
|
|
|
|
|
<div>
|
|
|
|
<mat-form-field class="matSelectionFormField">
|
|
|
|
<mat-label>Sort by:</mat-label>
|
|
|
|
<mat-select *ngIf="(entityType != 'community' && entityType != 'funder' )"
|
|
|
|
[(ngModel)]="sortBy" (ngModelChange)="sortByChanged()"
|
|
|
|
[disableOptionCentering]="true"
|
|
|
|
panelClass="matSelectionPanel"
|
|
|
|
class="uk-text-bold matSelection">
|
|
|
|
<mat-option value="">Relevance</mat-option>
|
|
|
|
<mat-option value="resultdateofacceptance,descending">Date (most recent)</mat-option>
|
|
|
|
<mat-option value="resultdateofacceptance,ascending">Date (least recent)</mat-option>
|
|
|
|
</mat-select>
|
|
|
|
|
|
|
|
<mat-select *ngIf="(entityType == 'community' || entityType == 'funder')">
|
|
|
|
class="uk-text-bold matSelection"
|
|
|
|
id="form-horizontal-select" name="select_results_per_page"
|
|
|
|
[(ngModel)]="sortBy" (ngModelChange)="sortByChanged()"
|
|
|
|
[disableOptionCentering]="true"
|
|
|
|
panelClass="matSelectionPanel">
|
|
|
|
<mat-option value="">Title</mat-option>
|
|
|
|
<mat-option value="creationdate,descending">Creation Date (most recent)</mat-option>
|
|
|
|
<mat-option value="creationdate,ascending">Creation Date (least recent)</mat-option>
|
|
|
|
</mat-select>
|
|
|
|
</mat-form-field>
|
|
|
|
</div>
|
2018-11-21 16:24:14 +01:00
|
|
|
`
|
|
|
|
})
|
|
|
|
|
|
|
|
export class SearchSortingComponent {
|
2019-04-05 19:21:23 +02:00
|
|
|
|
|
|
|
@Input() sortBy: string = '';
|
|
|
|
@Input() entityType: string = '';
|
2018-11-21 16:24:14 +01:00
|
|
|
@Output() sortByChange = new EventEmitter();
|
|
|
|
|
|
|
|
|
2019-04-05 19:21:23 +02:00
|
|
|
constructor () {}
|
2018-11-21 16:24:14 +01:00
|
|
|
|
|
|
|
ngOnInit() {}
|
|
|
|
|
|
|
|
|
|
|
|
sortByChanged() {
|
|
|
|
this.sortByChange.emit({
|
|
|
|
value: this.sortBy
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|