fix: update core and apply stricter tslint rules

This commit is contained in:
Michel Jonathan Schmitz
2019-07-10 12:38:29 +02:00
parent 03c317430a
commit 911492d064
67 changed files with 1291 additions and 507 deletions

View File

@@ -13,8 +13,11 @@
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {Injectable} from '@angular/core';
import {SCBackendAggregationConfiguration, SCFacet, SCThing, SCFacetBucket} from '@openstapps/core';
import {SCBackendAggregationConfiguration, SCFacet, SCFacetBucket, SCThing} from '@openstapps/core';
/**
* TODO
*/
@Injectable()
export class DataFacetsProvider {
// tslint:disable-next-line:no-empty
@@ -29,7 +32,8 @@ export class DataFacetsProvider {
* @param bucketsMap Buckets array transformed into a map
* @param fields A field that should be added to buckets (its map)
*/
addBuckets(bucketsMap: {[key: string]: number}, fields: string[]): {[key: string]: number} {
// tslint:disable-next-line:prefer-function-over-method
addBuckets(bucketsMap: {[key: string]: number; }, fields: string[]): {[key: string]: number; } {
fields.forEach((field) => {
if (typeof bucketsMap[field] !== 'undefined') {
bucketsMap[field] = bucketsMap[field] + 1;
@@ -37,6 +41,7 @@ export class DataFacetsProvider {
bucketsMap[field] = 1;
}
});
return bucketsMap;
}
@@ -45,61 +50,16 @@ export class DataFacetsProvider {
*
* @param buckets Buckets from a facet
*/
bucketsToMap(buckets: SCFacetBucket[]): {[key: string]: number} {
const bucketsMap: {[key: string]: number} = {};
// tslint:disable-next-line:prefer-function-over-method
bucketsToMap(buckets: SCFacetBucket[]): {[key: string]: number; } {
const bucketsMap: {[key: string]: number; } = {};
buckets.forEach((bucket) => {
bucketsMap[bucket.key] = bucket.count;
});
return bucketsMap;
}
/**
* Converts a buckets map into buckets array (as it is inside of a facet)
*
* @param bucketsMap A map from a buckets array
*/
mapToBuckets(bucketsMap: {[key: string]: number}): SCFacetBucket[] {
const buckets: SCFacetBucket[] = [];
for (const key in bucketsMap) {
if (bucketsMap.hasOwnProperty(key)) {
const bucket: SCFacetBucket = {key: key, count: bucketsMap[key]};
buckets.push(bucket);
}
}
return buckets;
}
/**
* Converts facets array into a map (for quicker operations with facets)
*
* @param facets Array of facets
*/
facetsToMap(facets: SCFacet[]): {[key: string]: {[key: string]: number}} {
const facetsMap: {[key: string]: {[key: string]: number}} = {};
facets.forEach((facet) => {
facetsMap[facet.field] = this.bucketsToMap(facet.buckets);
});
return facetsMap;
}
/**
* Converts facets map into an array of facets (as they are provided by backend)
*
* @param facetsMap A map from facets array
*/
mapToFacets(facetsMap: {[key: string]: {[key: string]: number}}): SCFacet[] {
const facets: SCFacet[] = [];
for (const key in facetsMap) {
if (facetsMap.hasOwnProperty(key)) {
const facet: SCFacet = {buckets: [], field: ''};
facet.field = key;
facet.buckets = this.mapToBuckets(facetsMap[key]);
facets.push(facet);
}
}
return facets;
}
/**
* Extract facets from data items, optionally combine them with a list of existing facets
*
@@ -114,12 +74,12 @@ export class DataFacetsProvider {
if (items.length === 0) {
if (facets.length === 0) {
return [];
} else {
return facets;
}
return facets;
}
const combinedFacets: SCFacet[] = facets;
const combinedFacetsMap: {[key: string]: {[key: string]: number}} = this.facetsToMap(combinedFacets);
const combinedFacetsMap: {[key: string]: {[key: string]: number; }; } = this.facetsToMap(combinedFacets);
(items as any[]).forEach((item) => {
aggregations.forEach((aggregation) => {
let fieldValues: string | string[] = item[aggregation.fieldName];
@@ -142,6 +102,58 @@ export class DataFacetsProvider {
}
});
});
return this.mapToFacets(combinedFacetsMap);
}
/**
* Converts facets array into a map (for quicker operations with facets)
*
* @param facets Array of facets
*/
facetsToMap(facets: SCFacet[]): {[key: string]: {[key: string]: number; }; } {
const facetsMap: {[key: string]: {[key: string]: number; }; } = {};
facets.forEach((facet) => {
facetsMap[facet.field] = this.bucketsToMap(facet.buckets);
});
return facetsMap;
}
/**
* Converts a buckets map into buckets array (as it is inside of a facet)
*
* @param bucketsMap A map from a buckets array
*/
// tslint:disable-next-line:prefer-function-over-method
mapToBuckets(bucketsMap: {[key: string]: number; }): SCFacetBucket[] {
const buckets: SCFacetBucket[] = [];
for (const key in bucketsMap) {
if (bucketsMap.hasOwnProperty(key)) {
const bucket: SCFacetBucket = {key: key, count: bucketsMap[key]};
buckets.push(bucket);
}
}
return buckets;
}
/**
* Converts facets map into an array of facets (as they are provided by backend)
*
* @param facetsMap A map from facets array
*/
mapToFacets(facetsMap: {[key: string]: {[key: string]: number; }; }): SCFacet[] {
const facets: SCFacet[] = [];
for (const key in facetsMap) {
if (facetsMap.hasOwnProperty(key)) {
const facet: SCFacet = {buckets: [], field: ''};
facet.field = key;
facet.buckets = this.mapToBuckets(facetsMap[key]);
facets.push(facet);
}
}
return facets;
}
}

View File

@@ -22,6 +22,9 @@ const dataRoutes: Routes = [
{path: 'data-detail/:uid', component: DataDetailComponent},
];
/**
* TODO
*/
@NgModule({
exports: [
RouterModule,

View File

@@ -26,13 +26,15 @@ import {DataRoutingModule} from './data-routing.module';
import {DataProvider} from './data.provider';
import {DataDetailContentComponent} from './detail/data-detail-content.component';
import {DataDetailComponent} from './detail/data-detail.component';
import {OffersDetailComponent} from './elements/offers-detail.component';
import {OffersInListComponent} from './elements/offers-in-list.component';
import {AddressDetailComponent} from './elements/address-detail.component';
import {LongInlineText} from './elements/long-inline-text.component';
import {OffersDetailComponent} from './elements/offers-detail.component';
import {OffersInListComponent} from './elements/offers-in-list.component';
import {OriginDetailComponent} from './elements/origin-detail.component';
import {OriginInListComponent} from './elements/origin-in-list.component';
import {SimpleCardComponent} from './elements/simple-card.component';
import {SkeletonListItem} from './elements/skeleton-list-item.component';
import {SkeletonSimpleCard} from './elements/skeleton-simple-card.component';
import {DataListItem} from './list/data-list-item.component';
import {DataListComponent} from './list/data-list.component';
import {StAppsWebHttpClient} from './stapps-web-http-client.provider';
@@ -60,9 +62,10 @@ import {SemesterDetailContentComponent} from './types/semester/semester-detail-c
import {SemesterListItem} from './types/semester/semester-list-item.component';
import {VideoDetailContentComponent} from './types/video/video-detail-content.component';
import {VideoListItem} from './types/video/video-list-item.component';
import {SkeletonListItem} from './elements/skeleton-list-item.component';
import {SkeletonSimpleCard} from './elements/skeleton-simple-card.component';
/**
* TODO
*/
@NgModule({
declarations: [
OffersDetailComponent,

View File

@@ -24,41 +24,64 @@ export enum DataScope {
Remote = 'remote',
}
/*
Generated class for the DataProvider provider.
See https://angular.io/guide/dependency-injection for more info on providers
and Angular DI.
*/
/**
* Generated class for the DataProvider provider.
*
* See https://angular.io/guide/dependency-injection for more info on providers
* and Angular DI.
*/
@Injectable()
export class DataProvider {
private _storagePrefix: string = 'stapps.data';
// @TODO: get backendUrl and appVersion and storagePrefix from config (module)
appVersion: string = '1.0.6';
backendUrl: string = 'http://localhost:3000';
/**
* TODO
*/
private _storagePrefix = 'stapps.data';
/**
* TODO
*
* @TODO: get backendUrl and appVersion and storagePrefix from config (module)
*/
appVersion = '1.0.6';
/**
* TODO
*/
backendUrl = 'http://localhost:3000';
/**
* TODO
*/
client: Client;
/**
* TODO
*/
storageProvider: StorageProvider;
/**
* TODO
*
* @param stAppsWebHttpClient TODO
* @param storageProvider TODO
*/
constructor(stAppsWebHttpClient: StAppsWebHttpClient, storageProvider: StorageProvider) {
this.client = new Client(stAppsWebHttpClient, this.backendUrl, this.appVersion);
this.storageProvider = storageProvider;
}
get storagePrefix(): string {
return this._storagePrefix;
}
set storagePrefix(storagePrefix) {
this._storagePrefix = storagePrefix;
/**
* Delete a data item
*
* @param uid Unique identifier of the saved data item
*/
async delete(uid: string): Promise<void> {
return this.storageProvider.delete(this.getDataKey(uid));
}
/**
* Provides key for storing data into the local database
*
* @param uid Unique identifier of a resource
* Delete all the previously saved data items
*/
getDataKey(uid: string): string {
return `${this.storagePrefix}.${uid}`;
async deleteAll(): Promise<void> {
const keys = Array.from((await this.getAll()).keys());
return this.storageProvider.delete(...keys);
}
/**
@@ -91,6 +114,7 @@ export class DataProvider {
const map: Map<DataScope, SCThings | SCSaveableThing<SCThings>> = new Map();
map.set(DataScope.Local, await this.get(uid, DataScope.Local));
map.set(DataScope.Remote, await this.get(uid, DataScope.Remote));
return map;
}
@@ -101,6 +125,24 @@ export class DataProvider {
return this.storageProvider.search<SCSaveableThing<SCThings>>(this.storagePrefix);
}
/**
* Provides key for storing data into the local database
*
* @param uid Unique identifier of a resource
*/
getDataKey(uid: string): string {
return `${this.storagePrefix}.${uid}`;
}
/**
* Provides information if something with an UID is saved as a data item
*
* @param uid Unique identifier of the saved data item
*/
async isSaved(uid: string): Promise<boolean> {
return this.storageProvider.has(this.getDataKey(uid));
}
/**
* Save a data item
*
@@ -118,25 +160,9 @@ export class DataProvider {
type: (typeof type === 'undefined') ? item.type : type,
uid: item.uid,
};
// @TODO: Implementation for saving item into the backend (user's account)
return (await this.storageProvider.put<SCSaveableThing<SCThings>>(this.getDataKey(item.uid), saveableItem));
}
/**
* Delete a data item
*
* @param uid Unique identifier of the saved data item
*/
async delete(uid: string): Promise<void> {
return this.storageProvider.delete(this.getDataKey(uid));
}
/**
* Delete all the previously saved data items
*/
async deleteAll(): Promise<void> {
const keys = Array.from((await this.getAll()).keys());
return this.storageProvider.delete(...keys);
return ( this.storageProvider.put<SCSaveableThing<SCThings>>(this.getDataKey(item.uid), saveableItem));
}
/**
@@ -145,15 +171,20 @@ export class DataProvider {
* @param query - query to send to the backend
*/
async search(query: SCSearchQuery): Promise<SCSearchResponse> {
return (await this.client.search(query));
return (this.client.search(query));
}
/**
* Provides information if something with an UID is saved as a data item
*
* @param uid Unique identifier of the saved data item
* TODO
*/
async isSaved(uid: string): Promise<boolean> {
return this.storageProvider.has(this.getDataKey(uid));
get storagePrefix(): string {
return this._storagePrefix;
}
/**
* TODO
*/
set storagePrefix(storagePrefix) {
this._storagePrefix = storagePrefix;
}
}

View File

@@ -15,10 +15,16 @@
import {Component, Input} from '@angular/core';
import {SCThings} from '@openstapps/core';
/**
* TODO
*/
@Component({
selector: 'stapps-data-detail-content',
templateUrl: 'data-detail-content.html',
})
export class DataDetailContentComponent {
/**
* TODO
*/
@Input() item: SCThings;
}

View File

@@ -19,17 +19,35 @@ import {LangChangeEvent, TranslateService} from '@ngx-translate/core';
import {SCLanguageCode, SCThing, SCUuid} from '@openstapps/core';
import {DataProvider, DataScope} from '../data.provider';
/**
* TODO
*/
@Component({
selector: 'stapps-data-detail',
styleUrls: ['data-detail.scss'],
templateUrl: 'data-detail.html',
})
export class DataDetailComponent {
/**
* TODO
*/
dataProvider: DataProvider;
/**
* TODO
*/
item: SCThing;
/**
* TODO
*/
language: SCLanguageCode;
constructor(private route: ActivatedRoute, dataProvider: DataProvider, translateService: TranslateService) {
/**
*
* @param route TODO
* @param dataProvider TODO
* @param translateService TODO
*/
constructor(private readonly route: ActivatedRoute, dataProvider: DataProvider, translateService: TranslateService) {
this.dataProvider = dataProvider;
this.language = translateService.currentLang as SCLanguageCode;
translateService.onLangChange.subscribe((event: LangChangeEvent) => {
@@ -43,11 +61,16 @@ export class DataDetailComponent {
* @param uid Unique identifier of a thing
*/
async getItem(uid: SCUuid): Promise<void> {
this.dataProvider.get(uid, DataScope.Remote).then((data) => {
await this.dataProvider.get(uid, DataScope.Remote)
.then((data) => {
this.item = data;
});
});
}
/**
* TODO
*/
// tslint:disable-next-line:prefer-function-over-method
ngOnInit() {
this.getItem(this.route.snapshot.paramMap.get('uid') || '');
}

View File

@@ -15,10 +15,16 @@
import {Component, Input} from '@angular/core';
import {SCPostalAddress} from '@openstapps/core';
/**
* TODO
*/
@Component({
selector: 'stapps-address-detail',
templateUrl: 'address-detail.html',
})
export class AddressDetailComponent {
/**
* TODO
*/
@Input() address: SCPostalAddress;
}

View File

@@ -14,11 +14,20 @@
*/
import {Component, Input} from '@angular/core';
/**
* TODO
*/
@Component({
selector: 'stapps-long-inline-text',
templateUrl: 'long-inline-text.html',
})
export class LongInlineText {
@Input() text: string;
/**
* TODO
*/
@Input() size: number;
/**
* TODO
*/
@Input() text: string;
}

View File

@@ -15,11 +15,20 @@
import {Component, Input} from '@angular/core';
import {SCAcademicPriceGroup, SCThingThatCanBeOfferedOffer} from '@openstapps/core';
/**
* TODO
*/
@Component({
selector: 'stapps-offers-detail',
templateUrl: 'offers-detail.html',
})
export class OffersDetailComponent {
/**
* TODO
*/
objectKeys = Object.keys;
/**
* TODO
*/
@Input() offers: Array<SCThingThatCanBeOfferedOffer<SCAcademicPriceGroup>>;
}

View File

@@ -15,10 +15,16 @@
import {Component, Input} from '@angular/core';
import {SCAcademicPriceGroup, SCThingThatCanBeOfferedOffer} from '@openstapps/core';
/**
* TODO
*/
@Component({
selector: 'stapps-offers-in-list',
templateUrl: 'offers-in-list.html',
})
export class OffersInListComponent {
/**
* TODO
*/
@Input() offers: Array<SCThingThatCanBeOfferedOffer<SCAcademicPriceGroup>>;
}

View File

@@ -15,10 +15,16 @@
import {Component, Input} from '@angular/core';
import {SCThingOrigin} from '@openstapps/core';
/**
* TODO
*/
@Component({
selector: 'stapps-origin-detail',
templateUrl: 'origin-detail.html',
})
export class OriginDetailComponent {
/**
* TODO
*/
@Input() origin: SCThingOrigin;
}

View File

@@ -15,10 +15,16 @@
import {Component, Input} from '@angular/core';
import {SCThingOrigin} from '@openstapps/core';
/**
* TODO
*/
@Component({
selector: 'stapps-origin-in-list',
templateUrl: 'origin-in-list.html',
})
export class OriginInListComponent {
/**
* TODO
*/
@Input() origin: SCThingOrigin;
}

View File

@@ -15,18 +15,41 @@
import {Component, Input} from '@angular/core';
import {isThing, SCThing} from '@openstapps/core';
/**
* TODO
*/
@Component({
selector: 'stapps-simple-card',
templateUrl: 'simple-card.html',
})
export class SimpleCardComponent {
areThings: boolean = false;
/**
* TODO
*/
areThings = false;
/**
* TODO
*/
@Input() content: string | string[] | SCThing[];
@Input() isMarkdown: boolean = false;
/**
* TODO
*/
@Input() isMarkdown = false;
/**
* TODO
*/
@Input() title: string;
/**
* TODO
*/
// tslint:disable-next-line:prefer-function-over-method
isString(data: any): data is string {
return typeof data === 'string';
}
/**
* TODO
*/
// tslint:disable-next-line:prefer-function-over-method
isThing(something: any): something is SCThing {
return isThing(something);
}

View File

@@ -14,6 +14,9 @@
*/
import {Component} from '@angular/core';
/**
* TODO
*/
@Component({
selector: 'stapps-skeleton-list-item',
templateUrl: 'skeleton-list-item.html',

View File

@@ -14,6 +14,9 @@
*/
import {Component} from '@angular/core';
/**
* TODO
*/
@Component({
selector: 'stapps-skeleton-simple-card',
templateUrl: 'skeleton-simple-card.html',

View File

@@ -15,19 +15,32 @@
import {Component, Input, OnInit} from '@angular/core';
import {SCThings} from '@openstapps/core';
/**
* TODO
*/
@Component({
selector: 'stapps-data-list-item',
styleUrls: ['data-list-item.scss'],
templateUrl: 'data-list-item.html',
})
export class DataListItem implements OnInit {
/**
* TODO
*/
@Input() item: SCThings;
/**
* TODO
*/
constructor() {
// noop
// this.item is not available yet
}
/**
* TODO
*/
// tslint:disable-next-line:prefer-function-over-method
ngOnInit() {
// noop
// this.item is available now - the template is loaded and compiled

View File

@@ -19,24 +19,58 @@ import {Subject} from 'rxjs';
import {debounceTime, distinctUntilChanged} from 'rxjs/operators';
import {DataProvider} from '../data.provider';
/**
* TODO
*/
@Component({
selector: 'stapps-data-list',
templateUrl: 'data-list.html',
})
export class DataListComponent {
/**
* TODO
*/
dataProvider: DataProvider;
/**
* TODO
*/
from = 0;
/**
* TODO
*/
items: SCThing[];
selectedItem: any;
loaded: boolean = false;
size: number = 30;
from: number = 0;
/**
* TODO
*/
loaded = false;
/**
* TODO
*/
query: string;
/**
* TODO
*/
queryChanged: Subject<string> = new Subject<string>();
/**
* TODO
*/
selectedItem: any;
/**
* TODO
*/
size = 30;
/**
*
* @param alertController TODO
* @param dataProvider TODO
*/
constructor(
private alertController: AlertController,
private readonly alertController: AlertController,
dataProvider: DataProvider,
) {
this.dataProvider = dataProvider;
@@ -52,31 +86,41 @@ export class DataListComponent {
this.fetchItems();
}
/**
* TODO
*/
private async fetchItems(): Promise<any> {
return this.dataProvider.search({
from: this.from,
query: this.query,
size: this.size,
} as any).then((result) => {
this.items = result.data;
this.loaded = true;
}, async (err) => {
const alert: HTMLIonAlertElement = await this.alertController.create({
buttons: ['Dismiss'],
header: 'Error',
subHeader: err.message,
});
} as any)
.then((result) => {
this.items = result.data;
this.loaded = true;
}, async (err) => {
const alert: HTMLIonAlertElement = await this.alertController.create({
buttons: ['Dismiss'],
header: 'Error',
subHeader: err.message,
});
await alert.present();
});
await alert.present();
});
}
/**
* TODO
*/
async loadMore(event: any): Promise<void> {
this.from += this.size;
await this.fetchItems();
event.target.complete();
}
/**
* TODO
*/
search(query: string) {
this.queryChanged.next(query);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 StApps
* Copyright (C) 2018, 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -14,15 +14,18 @@
*/
import {HttpClient, HttpResponse} from '@angular/common/http';
import {Injectable} from '@angular/core';
import {HttpClientInterface} from '@openstapps/api/lib/httpClientInterface';
import {HttpClientRequest} from '@openstapps/api/lib/httpClientInterface';
import {HttpClientInterface, HttpClientRequest} from '@openstapps/api/lib/http-client-interface';
/**
* HttpClient that is based on angular's HttpClient (@TODO: move it to provider or independent package)
*/
@Injectable()
export class StAppsWebHttpClient implements HttpClientInterface {
constructor(private http: HttpClient) {
/**
*
* @param http TODO
*/
constructor(private readonly http: HttpClient) {
}
/**
@@ -33,7 +36,13 @@ export class StAppsWebHttpClient implements HttpClientInterface {
requestConfig: HttpClientRequest,
): Promise<Response<TYPE_OF_BODY>> {
const options: {
/**
* TODO
*/
[key: string]: any;
/**
* TODO
*/
observe: 'response';
} = {
body: {},
@@ -53,6 +62,7 @@ export class StAppsWebHttpClient implements HttpClientInterface {
const response: HttpResponse<TYPE_OF_BODY> = await this.http.request<TYPE_OF_BODY>(
requestConfig.method || 'GET', requestConfig.url.toString(), options)
.toPromise();
return Object.assign(response, {statusCode: response.status, body: response.body || {}});
} catch (err) {
throw Error(err);
@@ -64,6 +74,12 @@ export class StAppsWebHttpClient implements HttpClientInterface {
* Response with generic for the type of body that is returned from the request
*/
export interface Response<TYPE_OF_BODY> extends HttpResponse<TYPE_OF_BODY> {
/**
* TODO
*/
body: TYPE_OF_BODY;
/**
* TODO
*/
statusCode: number;
}

View File

@@ -16,16 +16,34 @@ import {Component, Input} from '@angular/core';
import {SCArticle, SCThing, SCTranslations} from '@openstapps/core';
import {SCThingTranslator} from '@openstapps/core';
/**
* TODO
*/
@Component({
selector: 'stapps-article-detail-content',
templateUrl: 'article-detail-content.html',
})
export class ArticleDetailContentComponent {
/**
* TODO
*/
@Input() item: SCArticle;
/**
* TODO
*/
@Input() language: keyof SCTranslations<SCThing>;
/**
* TODO
*/
objectKeys = Object.keys;
/**
* TODO
*/
translator: SCThingTranslator;
/**
* TODO
*/
constructor() {
this.translator = new SCThingTranslator(this.language, 'de');
this.translator = new SCThingTranslator(this.language);
}
}

View File

@@ -16,14 +16,24 @@ import {Component, Input} from '@angular/core';
import {SCArticle} from '@openstapps/core';
import {DataListItem} from '../../list/data-list-item.component';
/**
* TODO
*/
@Component({
selector: 'stapps-article-list-item',
templateUrl: 'article-list-item.html',
})
export class ArticleListItem extends DataListItem {
/**
* TODO
*/
@Input() item: SCArticle;
/**
* TODO
*/
// tslint:disable-next-line:prefer-function-over-method
ngOnInit() {
// TODO: translation
}

View File

@@ -16,16 +16,34 @@ import {Component, Input} from '@angular/core';
import {SCCatalog, SCThing, SCTranslations} from '@openstapps/core';
import {SCThingTranslator} from '@openstapps/core';
/**
* TODO
*/
@Component({
selector: 'stapps-catalog-detail-content',
templateUrl: 'catalog-detail-content.html',
})
export class CatalogDetailContentComponent {
/**
* TODO
*/
@Input() item: SCCatalog;
/**
* TODO
*/
@Input() language: keyof SCTranslations<SCThing>;
/**
* TODO
*/
objectKeys = Object.keys;
/**
* TODO
*/
translator: SCThingTranslator;
/**
* TODO
*/
constructor() {
this.translator = new SCThingTranslator(this.language, 'de');
this.translator = new SCThingTranslator(this.language);
}
}

View File

@@ -16,14 +16,24 @@ import {Component, Input} from '@angular/core';
import {SCCatalog} from '@openstapps/core';
import {DataListItem} from '../../list/data-list-item.component';
/**
* TODO
*/
@Component({
selector: 'stapps-catalog-list-item',
templateUrl: 'catalog-list-item.html',
})
export class CatalogListItem extends DataListItem {
/**
* TODO
*/
@Input() item: SCCatalog;
/**
* TODO
*/
// tslint:disable-next-line:prefer-function-over-method
ngOnInit() {
// TODO: translation
}

View File

@@ -16,16 +16,34 @@ import {Component, Input} from '@angular/core';
import {SCDateSeries, SCThing, SCTranslations} from '@openstapps/core';
import {SCThingTranslator} from '@openstapps/core';
/**
* TODO
*/
@Component({
selector: 'stapps-date-series-detail-content',
templateUrl: 'date-series-detail-content.html',
})
export class DateSeriesDetailContentComponent {
/**
* TODO
*/
@Input() item: SCDateSeries;
/**
* TODO
*/
@Input() language: keyof SCTranslations<SCThing>;
/**
* TODO
*/
objectKeys = Object.keys;
/**
* TODO
*/
translator: SCThingTranslator;
/**
* TODO
*/
constructor() {
this.translator = new SCThingTranslator(this.language, 'de');
this.translator = new SCThingTranslator(this.language);
}
}

View File

@@ -16,14 +16,24 @@ import {Component, Input} from '@angular/core';
import {SCDateSeries} from '@openstapps/core';
import {DataListItem} from '../../list/data-list-item.component';
/**
* TODO
*/
@Component({
selector: 'stapps-date-series-list-item',
templateUrl: 'date-series-list-item.html',
})
export class DateSeriesListItem extends DataListItem {
/**
* TODO
*/
@Input() item: SCDateSeries;
/**
* TODO
*/
// tslint:disable-next-line:prefer-function-over-method
ngOnInit() {
// TODO: translation
}

View File

@@ -16,16 +16,34 @@ import {Component, Input} from '@angular/core';
import {SCDish, SCThing, SCTranslations} from '@openstapps/core';
import {SCThingTranslator} from '@openstapps/core';
/**
* TODO
*/
@Component({
selector: 'stapps-dish-detail-content',
templateUrl: 'dish-detail-content.html',
})
export class DishDetailContentComponent {
/**
* TODO
*/
@Input() item: SCDish;
/**
* TODO
*/
@Input() language: keyof SCTranslations<SCThing>;
/**
* TODO
*/
objectKeys = Object.keys;
/**
* TODO
*/
translator: SCThingTranslator;
/**
* TODO
*/
constructor() {
this.translator = new SCThingTranslator(this.language, 'de');
this.translator = new SCThingTranslator(this.language);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 StApps
* Copyright (C) 2018, 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -17,12 +17,18 @@ import {SCDish} from '@openstapps/core';
// import {SettingsProvider} from '../../../settings/settings.provider';
import {DataListItem} from '../../list/data-list-item.component';
/**
* TODO
*/
@Component({
selector: 'stapps-dish-list-item',
templateUrl: 'dish-list-item.html',
})
export class DishListItem extends DataListItem {
/**
* TODO
*/
@Input() item: SCDish;
// settingsProvider: SettingsProvider;
@@ -31,6 +37,10 @@ export class DishListItem extends DataListItem {
// this.settingsProvider = settingsProvider;
// }
/**
* TODO
*/
// tslint:disable-next-line:prefer-function-over-method
ngOnInit() {
// TODO: translation...
}

View File

@@ -16,16 +16,34 @@ import {Component, Input} from '@angular/core';
import {SCAcademicEvent, SCSportCourse, SCThing, SCTranslations} from '@openstapps/core';
import {SCThingTranslator} from '@openstapps/core';
/**
* TODO
*/
@Component({
selector: 'stapps-event-detail-content',
templateUrl: 'event-detail-content.html',
})
export class EventDetailContentComponent {
/**
* TODO
*/
@Input() item: SCAcademicEvent | SCSportCourse;
/**
* TODO
*/
@Input() language: keyof SCTranslations<SCThing>;
/**
* TODO
*/
objectKeys = Object.keys;
/**
* TODO
*/
translator: SCThingTranslator;
/**
* TODO
*/
constructor() {
this.translator = new SCThingTranslator(this.language, 'de');
this.translator = new SCThingTranslator(this.language);
}
}

View File

@@ -16,13 +16,23 @@ import {Component, Input} from '@angular/core';
import {SCAcademicEvent, SCSportCourse} from '@openstapps/core';
import {DataListItem} from '../../list/data-list-item.component';
/**
* TODO
*/
@Component({
selector: 'stapps-event-list-item',
templateUrl: 'event-list-item.html',
})
export class EventListItemComponent extends DataListItem {
/**
* TODO
*/
@Input() item: SCAcademicEvent | SCSportCourse;
/**
* TODO
*/
// tslint:disable-next-line:prefer-function-over-method
ngOnInit() {
// TODO: translation
}

View File

@@ -16,16 +16,34 @@ import {Component, Input} from '@angular/core';
import {SCFavorite, SCThing, SCTranslations} from '@openstapps/core';
import {SCThingTranslator} from '@openstapps/core';
/**
* TODO
*/
@Component({
selector: 'stapps-favorite-detail-content',
templateUrl: 'favorite-detail-content.html',
})
export class FavoriteDetailContentComponent {
/**
* TODO
*/
@Input() item: SCFavorite;
/**
* TODO
*/
@Input() language: keyof SCTranslations<SCThing>;
/**
* TODO
*/
objectKeys = Object.keys;
/**
* TODO
*/
translator: SCThingTranslator;
/**
* TODO
*/
constructor() {
this.translator = new SCThingTranslator(this.language, 'de');
this.translator = new SCThingTranslator(this.language);
}
}

View File

@@ -16,14 +16,24 @@ import {Component, Input} from '@angular/core';
import {SCFavorite} from '@openstapps/core';
import {DataListItem} from '../../list/data-list-item.component';
/**
* TODO
*/
@Component({
selector: 'stapps-favorite-list-item',
templateUrl: 'favorite-list-item.html',
})
export class FavoriteListItem extends DataListItem {
/**
* TODO
*/
@Input() item: SCFavorite;
/**
* TODO
*/
// tslint:disable-next-line:prefer-function-over-method
ngOnInit() {
// TODO: translation
}

View File

@@ -16,16 +16,34 @@ import {Component, Input} from '@angular/core';
import {SCMessage, SCThing, SCTranslations} from '@openstapps/core';
import {SCThingTranslator} from '@openstapps/core';
/**
* TODO
*/
@Component({
selector: 'stapps-message-detail-content',
templateUrl: 'message-detail-content.html',
})
export class MessageDetailContentComponent {
/**
* TODO
*/
@Input() item: SCMessage;
/**
* TODO
*/
@Input() language: keyof SCTranslations<SCThing>;
/**
* TODO
*/
objectKeys = Object.keys;
/**
* TODO
*/
translator: SCThingTranslator;
/**
* TODO
*/
constructor() {
this.translator = new SCThingTranslator(this.language, 'de');
this.translator = new SCThingTranslator(this.language);
}
}

View File

@@ -1,4 +1,4 @@
<stapps-simple-card [title]="'Content'" [content]="item.message"></stapps-simple-card>
<stapps-simple-card [title]="'Content'" [content]="item.messageBody"></stapps-simple-card>
<stapps-simple-card [title]="'Audiences'" [content]="item.audiences"></stapps-simple-card>
<stapps-simple-card *ngIf="item.datePublished" [title]="'Published'" [content]="item.datePublished | amDateFormat:'DD. MMM YYYY'"></stapps-simple-card>
<stapps-simple-card *ngIf="item.authors" [title]="'Author(s)'" [content]="item.authors"></stapps-simple-card>

View File

@@ -16,14 +16,24 @@ import {Component, Input} from '@angular/core';
import {SCMessage} from '@openstapps/core';
import {DataListItem} from '../../list/data-list-item.component';
/**
* TODO
*/
@Component({
selector: 'stapps-message-list-item',
templateUrl: 'message-list-item.html',
})
export class MessageListItem extends DataListItem {
/**
* TODO
*/
@Input() item: SCMessage;
/**
* TODO
*/
// tslint:disable-next-line:prefer-function-over-method
ngOnInit() {
// TODO: translation
}

View File

@@ -2,8 +2,8 @@
<ion-row>
<ion-col>
<h2 class="name">{{item.name}}</h2>
<p *ngIf="item.message">
<stapps-long-inline-text [text]="item.message" [size]="80"></stapps-long-inline-text>
<p *ngIf="item.messageBody">
<stapps-long-inline-text [text]="item.messageBody" [size]="80"></stapps-long-inline-text>
</p>
<ion-note>{{item.type}}</ion-note>
</ion-col>

View File

@@ -16,16 +16,35 @@ import {Component, Input} from '@angular/core';
import {SCOrganization, SCThing, SCTranslations} from '@openstapps/core';
import {SCThingTranslator} from '@openstapps/core';
/**
* TODO
*/
@Component({
selector: 'stapps-organization-detail-content',
templateUrl: 'organization-detail-content.html',
})
export class OrganizationDetailContentComponent {
/**
* TODO
*/
@Input() item: SCOrganization;
/**
* TODO
*/
@Input() language: keyof SCTranslations<SCThing>;
/**
* TODO
*/
objectKeys = Object.keys;
/**
* TODO
*/
translator: SCThingTranslator;
/**
* TODO
*/
constructor() {
this.translator = new SCThingTranslator(this.language, 'de');
this.translator = new SCThingTranslator(this.language);
}
}

View File

@@ -16,14 +16,24 @@ import {Component, Input} from '@angular/core';
import {SCOrganization} from '@openstapps/core';
import {DataListItem} from '../../list/data-list-item.component';
/**
* TODO
*/
@Component({
selector: 'stapps-organization-list-item',
templateUrl: 'organization-list-item.html',
})
export class OrganizationListItem extends DataListItem {
/**
* TODO
*/
@Input() item: SCOrganization;
/**
* TODO
*/
// tslint:disable-next-line:prefer-function-over-method
ngOnInit() {
// TODO: translation
}

View File

@@ -16,16 +16,35 @@ import {Component, Input} from '@angular/core';
import {SCPerson, SCThing, SCTranslations} from '@openstapps/core';
import {SCThingTranslator} from '@openstapps/core';
/**
* TODO
*/
@Component({
selector: 'stapps-person-detail-content',
templateUrl: 'person-detail-content.html',
})
export class PersonDetailContentComponent {
/**
* TODO
*/
@Input() item: SCPerson;
/**
* TODO
*/
@Input() language: keyof SCTranslations<SCThing>;
/**
* TODO
*/
objectKeys = Object.keys;
/**
* TODO
*/
translator: SCThingTranslator;
/**
* TODO
*/
constructor() {
this.translator = new SCThingTranslator(this.language, 'de');
this.translator = new SCThingTranslator(this.language);
}
}

View File

@@ -16,14 +16,24 @@ import {Component, Input} from '@angular/core';
import {SCPerson} from '@openstapps/core';
import {DataListItem} from '../../list/data-list-item.component';
/**
* TODO
*/
@Component({
selector: 'stapps-person-list-item',
templateUrl: 'person-list-item.html',
})
export class PersonListItem extends DataListItem {
/**
* TODO
*/
@Input() item: SCPerson;
/**
* TODO
*/
// tslint:disable-next-line:prefer-function-over-method
ngOnInit() {
// TODO: translation
}

View File

@@ -16,16 +16,35 @@ import {Component, Input} from '@angular/core';
import {SCBuilding, SCFloor, SCPointOfInterest, SCRoom, SCThing, SCTranslations} from '@openstapps/core';
import {SCThingTranslator} from '@openstapps/core';
/**
* TODO
*/
@Component({
selector: 'stapps-place-detail-content',
templateUrl: 'place-detail-content.html',
})
export class PlaceDetailContentComponent {
/**
* TODO
*/
@Input() item: SCBuilding | SCRoom | SCPointOfInterest | SCFloor;
/**
* TODO
*/
@Input() language: keyof SCTranslations<SCThing>;
/**
* TODO
*/
objectKeys = Object.keys;
/**
* TODO
*/
translator: SCThingTranslator;
/**
* TODO
*/
constructor() {
this.translator = new SCThingTranslator(this.language, 'de');
this.translator = new SCThingTranslator(this.language);
}
}

View File

@@ -16,14 +16,24 @@ import {Component, Input} from '@angular/core';
import {SCBuilding, SCFloor, SCPointOfInterest, SCRoom} from '@openstapps/core';
import {DataListItem} from '../../list/data-list-item.component';
/**
* TODO
*/
@Component({
selector: 'stapps-place-list-item',
templateUrl: 'place-list-item.html',
})
export class PlaceListItem extends DataListItem {
/**
* TODO
*/
@Input() item: SCBuilding | SCRoom | SCPointOfInterest | SCFloor;
/**
* TODO
*/
// tslint:disable-next-line:prefer-function-over-method
ngOnInit() {
// TODO: translation
}

View File

@@ -16,16 +16,35 @@ import {Component, Input} from '@angular/core';
import {SCSemester, SCThing, SCTranslations} from '@openstapps/core';
import {SCThingTranslator} from '@openstapps/core';
/**
* TODO
*/
@Component({
selector: 'stapps-semester-detail-content',
templateUrl: 'semester-detail-content.html',
})
export class SemesterDetailContentComponent {
/**
* TODO
*/
@Input() item: SCSemester;
/**
* TODO
*/
@Input() language: keyof SCTranslations<SCThing>;
/**
* TODO
*/
objectKeys = Object.keys;
/**
* TODO
*/
translator: SCThingTranslator;
/**
* TODO
*/
constructor() {
this.translator = new SCThingTranslator(this.language, 'de');
this.translator = new SCThingTranslator(this.language);
}
}

View File

@@ -16,14 +16,23 @@ import {Component, Input} from '@angular/core';
import {SCSemester} from '@openstapps/core';
import {DataListItem} from '../../list/data-list-item.component';
/**
* TODO
*/
@Component({
selector: 'stapps-semester-list-item',
templateUrl: 'semester-list-item.html',
})
export class SemesterListItem extends DataListItem {
/**
* TODO
*/
@Input() item: SCSemester;
/**
* TODO
*/
// tslint:disable-next-line:prefer-function-over-method
ngOnInit() {
// TODO: translation
}

View File

@@ -16,16 +16,35 @@ import {Component, Input} from '@angular/core';
import {SCThing, SCTranslations, SCVideo} from '@openstapps/core';
import {SCThingTranslator} from '@openstapps/core';
/**
* TODO
*/
@Component({
selector: 'stapps-video-detail-content',
templateUrl: 'video-detail-content.html',
})
export class VideoDetailContentComponent {
/**
* TODO
*/
@Input() item: SCVideo;
/**
* TODO
*/
@Input() language: keyof SCTranslations<SCThing>;
/**
* TODO
*/
objectKeys = Object.keys;
/**
* TODO
*/
translator: SCThingTranslator;
/**
* TODO
*/
constructor() {
this.translator = new SCThingTranslator(this.language, 'de');
this.translator = new SCThingTranslator(this.language);
}
}

View File

@@ -16,14 +16,23 @@ import {Component, Input} from '@angular/core';
import {SCVideo} from '@openstapps/core';
import {DataListItem} from '../../list/data-list-item.component';
/**
* TODO
*/
@Component({
selector: 'stapps-video-list-item',
templateUrl: 'video-list-item.html',
})
export class VideoListItem extends DataListItem {
/**
* TODO
*/
@Input() item: SCVideo;
/**
* TODO
*/
// tslint:disable-next-line:prefer-function-over-method
ngOnInit() {
// TODO: translation
}