mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-20 08:33:11 +00:00
refactor: update to recent changes in translator
This commit is contained in:
@@ -116,14 +116,14 @@ export class ContextMenuComponent {
|
||||
getTranslatedPropertyName(property: string, onlyForType?: SCThingType): string {
|
||||
return (this.translator
|
||||
// tslint:disable-next-line:no-any
|
||||
.translatedPropertyNames(onlyForType ? onlyForType : SCThingType.AcademicEvent) as any)[property];
|
||||
.translatedPropertyNames(typeof onlyForType !== 'undefined' ? onlyForType : SCThingType.AcademicEvent) as any)[property];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns translated type of given SCThingType string
|
||||
* Returns translated property value
|
||||
*/
|
||||
getTranslatedType(scThingType: string) {
|
||||
return this.translator.translatedThingType(scThingType as SCThingType);
|
||||
getTranslatedPropertyValue(onlyForType: SCThingType, field: string, key?: string): string | undefined {
|
||||
return this.translator.translatedPropertyValue(onlyForType, field, key);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -38,34 +38,34 @@
|
||||
<ion-list class="filter-group"
|
||||
*ngFor="let facet of !filterOption.compact ?
|
||||
filterOption.options.slice(0, compactFilterOptionCount) : filterOption.options">
|
||||
<ion-list-header class="h3">
|
||||
<ion-label>
|
||||
{{(facet.onlyOnType ?
|
||||
getTranslatedPropertyName(facet.field, facet.onlyOnType)
|
||||
: (getTranslatedPropertyName(facet.field))) | titlecase}}
|
||||
{{facet.onlyOnType? ' | ' + (getTranslatedType(facet.onlyOnType) | titlecase) : ''}}
|
||||
</ion-label>
|
||||
</ion-list-header>
|
||||
<div *ngIf="facet.buckets.length > 0">
|
||||
<ion-item
|
||||
*ngFor="let bucket of !facet.compact ?
|
||||
facet.buckets.slice(0, compactFilterOptionCount) : facet.buckets">
|
||||
<ion-label class="filter-item-label">
|
||||
({{bucket.count}}) {{facet.field === 'type' ? (getTranslatedType(bucket.key) | titlecase) : bucket.key | titlecase}}
|
||||
<div *ngIf="!facet.field.includes('.')">
|
||||
<ion-list-header class="h3">
|
||||
<ion-label>
|
||||
{{(facet.onlyOnType ? getTranslatedPropertyName(facet.field, facet.onlyOnType) : (getTranslatedPropertyName(facet.field))) | titlecase}}
|
||||
{{facet.onlyOnType ? ' | ' + (getTranslatedPropertyValue(facet.onlyOnType, 'type') | titlecase) : ''}}
|
||||
</ion-label>
|
||||
<ion-checkbox
|
||||
mode="ios"
|
||||
[(ngModel)]="bucket.checked"
|
||||
(ngModelChange)="filterChanged()"
|
||||
[value]="{field: facet.field, value: bucket.key, onlyOnType: facet.onlyOnType}">
|
||||
|
||||
</ion-checkbox>
|
||||
</ion-item>
|
||||
<ion-button fill="clear"
|
||||
*ngIf="!facet.compact && facet.buckets.length > compactFilterOptionCount"
|
||||
(click)="facet.compact = true">
|
||||
{{'menu.context.filter.showAll' | translate}}
|
||||
</ion-button>
|
||||
</ion-list-header>
|
||||
<div *ngIf="facet.buckets.length > 0">
|
||||
<ion-item
|
||||
*ngFor="let bucket of !facet.compact ?
|
||||
facet.buckets.slice(0, compactFilterOptionCount) : facet.buckets">
|
||||
<ion-label class="filter-item-label">
|
||||
({{bucket.count}}) {{facet.field === 'type' ? (getTranslatedPropertyValue(bucket.key, 'type') | titlecase) :
|
||||
getTranslatedPropertyValue(facet.onlyOnType, facet.field, bucket.key) | titlecase}}
|
||||
</ion-label>
|
||||
<ion-checkbox
|
||||
mode="ios"
|
||||
[(ngModel)]="bucket.checked"
|
||||
(ngModelChange)="filterChanged()"
|
||||
[value]="{field: facet.field, value: bucket.key, onlyOnType: facet.onlyOnType}">
|
||||
</ion-checkbox>
|
||||
</ion-item>
|
||||
<ion-button fill="clear"
|
||||
*ngIf="!facet.compact && facet.buckets.length > compactFilterOptionCount"
|
||||
(click)="facet.compact = true">
|
||||
{{'menu.context.filter.showAll' | translate}}
|
||||
</ion-button>
|
||||
</div>
|
||||
</div>
|
||||
</ion-list>
|
||||
<ion-button fill="clear"
|
||||
|
||||
Reference in New Issue
Block a user