1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00
pigallery2/frontend/app/pipes/StringifySortingMethod.ts
2018-05-28 14:03:12 -04:00

25 lines
715 B
TypeScript

import {Pipe, PipeTransform} from '@angular/core';
import {I18n} from '@ngx-translate/i18n-polyfill';
import {SortingMethods} from '../../../common/entities/SortingMethods';
@Pipe({name: 'stringifySorting'})
export class StringifySortingMethod implements PipeTransform {
constructor(private i18n: I18n) {
}
transform(method: SortingMethods): string {
switch (method) {
case SortingMethods.ascName:
return this.i18n('ascending name');
case SortingMethods.descName:
return this.i18n('descending name');
case SortingMethods.ascDate:
return this.i18n('ascending date');
case SortingMethods.descDate:
return this.i18n('descending date');
}
}
}