feat: add basic templates for data list items

This commit is contained in:
Jovan Krunić
2019-03-22 14:26:53 +01:00
parent 9850cf77c2
commit 3e697b17b4
47 changed files with 31480 additions and 95 deletions

24
package-lock.json generated
View File

@@ -2383,14 +2383,14 @@
"dev": true
},
"@openstapps/api": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/@openstapps/api/-/api-0.3.0.tgz",
"integrity": "sha512-5Irnxjyzo2keOEFXq0H3NQi71S51VsANu0ms/bXeAI0DlxOFirq5anBBnRT1gOJl349/4TTHYdQGNyW9HthBlA==",
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/@openstapps/api/-/api-0.4.1.tgz",
"integrity": "sha512-/+js8FNxTxusDfojr3JYhx1kdcoilBMbGB1+B6BpnObZ6Mg7MQRui2KRh7COe/1VPuVTe2mpqisAX7cjSsXGMw==",
"requires": {
"@openstapps/core": "0.11.0",
"@openstapps/core": "0.12.0",
"@openstapps/logger": "0.0.5",
"@types/cli-progress": "1.8.0",
"@types/node": "11.9.4",
"@types/cli-progress": "1.8.1",
"@types/node": "11.11.3",
"@types/request": "2.48.1",
"@types/uuid": "3.4.4",
"async-pool-native": "0.1.0",
@@ -2413,9 +2413,9 @@
}
},
"@types/node": {
"version": "11.9.4",
"resolved": "https://registry.npmjs.org/@types/node/-/node-11.9.4.tgz",
"integrity": "sha512-Zl8dGvAcEmadgs1tmSPcvwzO1YRsz38bVJQvH1RvRqSR9/5n61Q1ktcDL0ht3FXWR+ZpVmXVwN1LuH4Ax23NsA=="
"version": "11.11.3",
"resolved": "https://registry.npmjs.org/@types/node/-/node-11.11.3.tgz",
"integrity": "sha512-wp6IOGu1lxsfnrD+5mX6qwSwWuqsdkKKxTN4aQc4wByHAKZJf9/D4KXPQ1POUjEbnCP5LMggB0OEFNY9OTsMqg=="
}
}
},
@@ -2572,9 +2572,9 @@
"integrity": "sha512-7+kYB7x5a7nFWW1YPBh3KxhwKfiaI4PbZ1RvzBU91LZy7lWJO822CI+pqzSre/DZ7KsCuMKdHnLHHFu8AyXbQg=="
},
"@types/cli-progress": {
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/@types/cli-progress/-/cli-progress-1.8.0.tgz",
"integrity": "sha512-anbR1K9PtAzzB7Uc577Nq5KzgLhax1AuiJp7SC029wEZTmgpOT68uKOs+LMXpvLn0aVjwOiU6ijEwkcNWT0/JA==",
"version": "1.8.1",
"resolved": "https://registry.npmjs.org/@types/cli-progress/-/cli-progress-1.8.1.tgz",
"integrity": "sha512-W31ZRQPQ1CM42pb5iqs3TzQlMv/RDRsPZ6pTCsl71oLFqFI/TYors3Pukj6tMinlUmXmv+Az5RD/94fZPcxMrw==",
"requires": {
"@types/node": "*"
}

View File

@@ -40,7 +40,7 @@
"@ionic/storage": "2.2.0",
"@ngx-translate/core": "11.0.1",
"@ngx-translate/http-loader": "4.0.0",
"@openstapps/api": "0.3.0",
"@openstapps/api": "0.4.1",
"@openstapps/configuration": "0.7.0",
"@openstapps/core": "0.12.0",
"@openstapps/logger": "0.0.5",

File diff suppressed because it is too large Load Diff

View File

@@ -12,9 +12,13 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {HttpClient} from '@angular/common/http';
import {Injectable} from '@angular/core';
import {SCAcademicEvent, SCArticle, SCBook, SCBuilding, SCCatalog,
SCDateSeries, SCDish, SCFavorite, SCMessage, SCPerson, SCRoom,
SCThing, SCThingOriginType, SCThingType, SCToDo, SCToDoPriority} from '@openstapps/core';
import {Observable, of} from 'rxjs';
import {sampleResources} from './resources/test-resources';
const sampleMessages: SCMessage[] = [
{
@@ -45,8 +49,20 @@ const sampleMessages: SCMessage[] = [
const sampleDishes: SCDish[] = [
{
categories: ['main dish'],
categories: ['main dish', 'salad'],
name: 'Foo Dish',
// offers: [
// {
// 'availability': 'in stock',
// 'availabilityStarts': '2017-01-30T00:00:00.000Z',
// 'availabilityEnds': '2017-01-30T23:59:59.999Z',
// 'prices': {
// 'default': 4.85,
// 'student': 2.85,
// 'employee': 3.85,
// 'guest': 4.85,
// },
// ],
origin: {
indexed: 'SOME-DATE',
name: 'some name',
@@ -56,7 +72,7 @@ const sampleDishes: SCDish[] = [
uid: 'dish-123',
},
{
categories: ['side dish'],
categories: ['side dish', 'salad'],
name: 'Bar Dish',
origin: {
indexed: 'SOME-DATE',
@@ -368,3 +384,39 @@ export function getSampleThings(...uids: string[]): SCThing[] {
}
return sampleThings;
}
@Injectable()
export class SampleThings {
http: HttpClient;
constructor(http: HttpClient) {
this.http = http;
}
// getSampleThings(): Observable<any> {
// return this.http.get('http://localhost:8100/assets/json/joined.json');
// // return of(sampleDishes[0]);
// }
getSampleThings(): Observable<any[]> {
// const jsonContent: any[] = await this.http.get('http://localhost:8100/assets/json/joined.json').toPromise();
const sampleThings: any[] = [];
sampleResources.forEach((resource) => {
// tslint:disable-next-line:max-line-length
// if ([SCThingType.Video].includes(resource.instance.type as SCThingType)) {
sampleThings.push(resource.instance);
// }
});
return of(sampleThings);
}
getSampleThing(uid: string): Observable<any[]> {
// const jsonContent: any[] = await this.http.get('http://localhost:8100/assets/json/joined.json').toPromise();
const sampleThings: any[] = [];
for (const resource of sampleResources) {
if (resource.instance.uid as SCThingType === uid) {
sampleThings.push(resource.instance);
return of(sampleThings);
}
}
return of(sampleThings);
}
}

View File

@@ -12,34 +12,88 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {HTTP_INTERCEPTORS, HttpEvent,
HttpHandler, HttpInterceptor, HttpRequest, HttpResponse} from '@angular/common/http';
import {HTTP_INTERCEPTORS, HttpClient,
HttpEvent, HttpHandler, HttpInterceptor, HttpRequest, HttpResponse} from '@angular/common/http';
import {Injectable} from '@angular/core';
import {SCThing} from '@openstapps/core';
import {Observable, of} from 'rxjs';
import {getSampleThings} from './data/sampleThings';
import {Observable} from 'rxjs';
// import {SCThing} from '@openstapps/core';
// import {Observable, of} from 'rxjs';
import {map} from 'rxjs/operators';
import {SampleThings} from './data/sample-things';
@Injectable()
export class FakeBackendInterceptor implements HttpInterceptor {
sampleFetcher: SampleThings;
// http: HttpClient;
// tslint:disable-next-line:no-empty
constructor() {
constructor(http: HttpClient) {
this.sampleFetcher = new SampleThings(http);
// this.http = http;
}
// intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
// let data: SCThing[] = [];
// // fake responses for search requests for easier (backendless) development process
// if (request.url.endsWith('/search') && request.method === 'POST') {
// if (typeof request.body.filter !== 'undefined' && typeof request.body.filter.arguments !== 'undefined') {
// if (request.body.filter.arguments.field === 'uid') {
// // provide items with given uid for search requests requesting single items (detail view)
// data = getSampleThings(request.body.filter.arguments.value);
// return this.sampleFetcher.getSampleThings().pipe(map((sampleData: any) => {
// return new HttpResponse({status: 200, body: {data: [sampleData.instance]}});
// // return new HttpResponse({status: 200, body: {data: [sampleData.instance]}});
// }),
// // data = getSampleThings();
// );
// }
// } else {
// // if filter and arguments are not set, then provide all sample items (things)
// data = getSampleThings();
// // fake a response of the backend with previously defined data
// return of(new HttpResponse({status: 200, body: {data: data}}));
// }
// // fake a response of the backend with previously defined data
// // return of(new HttpResponse({status: 200, body: {data: data}}));
// return next.handle(request);
// } else {
// // for all other requests, forward the requests to actually requested URL (backend)
// return next.handle(request);
// }
// }
// }
// }
// intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
// // let data: SCThing[] = [];
// // fake responses for search requests for easier (backendless) development process
// if (request.url.endsWith('/search') && request.method === 'POST') {
// return this.sampleFetcher.getSampleThings().pipe(map((sampleData: any) => {
// return new HttpResponse({status: 200, body: {data: sampleData}});
// // return new HttpResponse({status: 200, body: {data: [sampleData.instance]}});
// }));
// // return of(new HttpResponse({status: 200, body: {data: data}}));
// } else {
// // for all other requests, forward the requests to actually requested URL (backend)
// return next.handle(request);
// }
// }
intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
let data: SCThing[] = [];
// let data: SCThing[] = [];
// fake responses for search requests for easier (backendless) development process
if (request.url.endsWith('/search') && request.method === 'POST') {
if (typeof request.body.filter !== 'undefined' && typeof request.body.filter.arguments !== 'undefined') {
if (request.body.filter.arguments.field === 'uid') {
// provide items with given uid for search requests requesting single items (detail view)
data = getSampleThings(request.body.filter.arguments.value);
return this.sampleFetcher.getSampleThing(request.body.filter.arguments.value).pipe(map((sampleData: any) => {
return new HttpResponse({status: 200, body: {data: sampleData}});
}));
}
} else {
// if filter and arguments are not set, then provide all sample items (things)
data = getSampleThings();
}
// fake a response of the backend with previously defined data
return of(new HttpResponse({status: 200, body: {data: data}}));
return this.sampleFetcher.getSampleThings().pipe(map((sampleData: any) => {
return new HttpResponse({status: 200, body: {data: sampleData}});
// return new HttpResponse({status: 200, body: {data: [sampleData.instance]}});
}));
// return of(new HttpResponse({status: 200, body: {data: data}}));
} else {
// for all other requests, forward the requests to actually requested URL (backend)
return next.handle(request);

View File

@@ -13,9 +13,9 @@
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {TestBed} from '@angular/core/testing';
import {SCFacet, SCThing} from '@openstapps/core';
import {sampleAggregations} from '../../_helpers/data/sampleConfiguration';
import {sampleThingsMap} from '../../_helpers/data/sampleThings';
import {SCFacet, SCThing, SCFacetBucket} from '@openstapps/core';
import {sampleAggregations} from '../../_helpers/data/sample-configuration';
import {sampleThingsMap} from '../../_helpers/data/sample-things';
import {DataFacetsProvider} from './data-facets.provider';
import {DataModule} from './data.module';
import {DataProvider} from './data.provider';
@@ -25,15 +25,15 @@ describe('DataProvider', () => {
let dataFacetsProvider: DataFacetsProvider;
const sampleFacets: SCFacet[] = [
{
buckets: [{education: 4}, {learn: 3}, {computer: 3}],
buckets: [{key: 'education', count: 4}, {key: 'learn', count: 3}, {key: 'computer', count: 3}],
field: 'categories',
},
{
buckets: [{'Major One': 1}, {'Major Two': 2}, {'Major Three': 1}],
buckets: [{key: 'Major One', count: 1}, {key: 'Major Two', count: 2}, {key: 'Major Three' , count: 1}],
field: 'majors',
},
{
buckets: [{building: 3}, {room: 7}],
buckets: [{key: 'building', count: 3}, {key: 'room', count: 7}],
field: 'type',
},
];
@@ -51,7 +51,7 @@ describe('DataProvider', () => {
...sampleThingsMap['academic event'],
];
const sampleBuckets: Array<{[key: string]: number}> = [{foo: 1}, {bar: 2}, {'foo bar': 3}];
const sampleBuckets: SCFacetBucket[] = [{key: 'foo', count: 1}, {key: 'bar', count: 2}, {key: 'foo bar', count: 3}];
const sampleBucketsMap: {[key: string]: number} = {foo: 1, bar: 2, 'foo bar': 3};
beforeEach(() => {
@@ -96,15 +96,18 @@ describe('DataProvider', () => {
it('should extract facets (and append them if needed) from the data', () => {
const sampleCombinedFacets: SCFacet[] = [
{
buckets: [{computer: 3}, {course: 1}, {education: 5}, {learn: 3}, {library: 1}, {practicum: 1}],
buckets: [
{key: 'computer', count: 3}, {key: 'course', count: 1}, {key: 'education', count: 5},
{key: 'learn', count: 3}, {key: 'library', count: 1}, {key: 'practicum', count: 1},
],
field: 'categories',
},
{
buckets: [{'Major One': 2}, {'Major Two': 4}, {'Major Three': 2}],
buckets: [{key: 'Major One', count: 2}, {key: 'Major Two', count: 4}, {key: 'Major Three', count: 2}],
field: 'majors',
},
{
buckets: [{building: 4}, {'academic event': 2}, {person: 2}, {room: 8}],
buckets: [{key: 'building', count: 4}, {key: 'academic event', count: 2}, {key: 'person', count: 2}, {key: 'room', count: 8}],
field: 'type',
},
];

View File

@@ -13,7 +13,7 @@
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {Injectable} from '@angular/core';
import {SCBackendAggregationConfiguration, SCFacet, SCThing} from '@openstapps/core';
import {SCBackendAggregationConfiguration, SCFacet, SCThing, SCFacetBucket} from '@openstapps/core';
@Injectable()
export class DataFacetsProvider {
@@ -45,14 +45,10 @@ export class DataFacetsProvider {
*
* @param buckets Buckets from a facet
*/
bucketsToMap(buckets: Array<{[key: string]: number}>): {[key: string]: number} {
bucketsToMap(buckets: SCFacetBucket[]): {[key: string]: number} {
const bucketsMap: {[key: string]: number} = {};
buckets.forEach((bucket) => {
for (const key in bucket) {
if (bucket.hasOwnProperty(key)) {
bucketsMap[key] = bucket[key];
}
}
bucketsMap[bucket.key] = bucket.count;
});
return bucketsMap;
}
@@ -62,12 +58,11 @@ export class DataFacetsProvider {
*
* @param bucketsMap A map from a buckets array
*/
mapToBuckets(bucketsMap: {[key: string]: number}): Array<{[key: string]: number}> {
const buckets: Array<{[key: string]: number}> = [];
mapToBuckets(bucketsMap: {[key: string]: number}): SCFacetBucket[] {
const buckets: SCFacetBucket[] = [];
for (const key in bucketsMap) {
if (bucketsMap.hasOwnProperty(key)) {
const bucket: {[key: string]: number} = {};
bucket[key] = bucketsMap[key];
const bucket: SCFacetBucket = {key: key, count: bucketsMap[key]};
buckets.push(bucket);
}
}

View File

@@ -23,24 +23,50 @@ import {DataFacetsProvider} from './data-facets.provider';
import {DataRoutingModule} from './data-routing.module';
import {DataProvider} from './data.provider';
import {DataDetailComponent} from './detail/data-detail.component';
import {LongInlineText} from './elements/long-inline-text.component';
import {OffersInListComponent} from './elements/offers-in-list.component';
import {DataListItem} from './list/data-list-item.component';
import {DataListComponent} from './list/data-list.component';
import {StAppsWebHttpClient} from './stapps-web-http-client.provider';
import {ArticleListItem} from './types/article/article-list-item.component';
import {CatalogListItem} from './types/catalog/catalog-list-item.component';
import {DateSeriesListItem} from './types/date-series/date-series-list-item.component';
import {DishDetailContentComponent} from './types/dish/dish-detail-content.component';
import {DishListItem} from './types/dish/dish-list-item.component';
import {EventListItemComponent} from './types/event/event-list-item.component';
import {FavoriteListItem} from './types/favorite/favorite-list-item.component';
import {MessageListItem} from './types/message/message-list-item.component';
import {OrganizationListItem} from './types/organization/organization-list-item.component';
import {PersonListItem} from './types/person/person-list-item.component';
import {PlaceListItem} from './types/place/place-list-item.component';
import {SemesterListItem} from './types/semester/semester-list-item.component';
import {VideoListItem} from './types/video/video-list-item.component';
@NgModule({
declarations: [
ArticleListItem,
CatalogListItem,
DataDetailComponent,
DishDetailContentComponent,
DishListItem,
EventListItemComponent,
FavoriteListItem,
DataListItem,
DataListComponent,
DateSeriesListItem,
OffersInListComponent,
LongInlineText,
MessageListItem,
OrganizationListItem,
PersonListItem,
PlaceListItem,
SemesterListItem,
VideoListItem,
],
entryComponents: [
DataListComponent,

View File

@@ -16,7 +16,7 @@ import {TestBed} from '@angular/core/testing';
import {Client} from '@openstapps/api/lib/client';
import {SCDish, SCMessage, SCSaveableThing, SCSearchQuery,
SCSearchResponse, SCSearchValueFilter, SCThing, SCThingOriginType, SCThings, SCThingType} from '@openstapps/core';
import {sampleThingsMap} from '../../_helpers/data/sampleThings';
import {sampleThingsMap} from '../../_helpers/data/sample-things';
import {StorageProvider} from '../storage/storage.provider';
import {DataModule} from './data.module';
import {DataProvider, DataScope} from './data.provider';

View File

@@ -17,7 +17,7 @@ import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import {ActivatedRoute, RouterModule} from '@angular/router';
import {IonRefresher} from '@ionic/angular';
import {TranslateFakeLoader, TranslateLoader, TranslateModule} from '@ngx-translate/core';
import {sampleThingsMap} from '../../../_helpers/data/sampleThings';
import {sampleThingsMap} from '../../../_helpers/data/sample-things';
import {DataRoutingModule} from '../data-routing.module';
import {DataModule} from '../data.module';
import {DataProvider} from '../data.provider';

View File

@@ -4,7 +4,7 @@
<ion-back-button></ion-back-button>
<ion-menu-button></ion-menu-button>
</ion-buttons>
<ion-title>{{'data.detail.TITLE' | translate}}</ion-title>
<ion-title text-center>{{'data.detail.TITLE' | translate}}</ion-title>
</ion-toolbar>
</ion-header>
<ion-content padding *ngIf="item">
@@ -16,10 +16,10 @@
<stapps-data-list-item [item]="item"></stapps-data-list-item>
<div [ngSwitch]="item.type">
<stapps-dish-detail-content [item]="item" *ngSwitchCase="'dish'"></stapps-dish-detail-content>
<!-- <stapps-dish-detail-content [item]="item" *ngSwitchCase="'dish'"></stapps-dish-detail-content> -->
<span *ngSwitchDefault>
<!-- <span *ngSwitchDefault>
<p *ngIf="item.description">{{item.description}}</p>
</span>
</span> -->
</div>
</ion-content>

View File

@@ -0,0 +1,24 @@
/*
* Copyright (C) 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.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {Component, Input} from '@angular/core';
@Component({
selector: 'stapps-long-inline-text',
templateUrl: 'long-inline-text.html',
})
export class LongInlineText {
@Input() text: string;
@Input() size: number;
}

View File

@@ -0,0 +1 @@
<span>{{text | slice:0:size}}<span *ngIf="text.length > size">...</span>

View File

@@ -0,0 +1,24 @@
/*
* Copyright (C) 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.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {Component, Input} from '@angular/core';
import {SCAcademicPriceGroup, SCThingThatCanBeOfferedOffer} from '@openstapps/core';
@Component({
selector: 'stapps-offers-in-list',
templateUrl: 'offers-in-list.html',
})
export class OffersInListComponent {
@Input() offers: Array<SCThingThatCanBeOfferedOffer<SCAcademicPriceGroup>>;
}

View File

@@ -0,0 +1,6 @@
<div>
<h2>{{offers[0].prices.default | currency:'EUR':'symbol':undefined:'de'}}</h2>
<p *ngIf="offers[0].inPlace">
<ion-icon name="pin"></ion-icon> {{offers[0].inPlace.name}} <span *ngIf="offers.length > 1">...</span>
</p>
</div>

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,7 +17,8 @@ import {SCThings} from '@openstapps/core';
@Component({
selector: 'stapps-data-list-item',
templateUrl: 'data-list-item.html'
styleUrls: ['data-list-item.scss'],
templateUrl: 'data-list-item.html',
})
export class DataListItem implements OnInit {
@Input() item: SCThings;

View File

@@ -1,17 +1,32 @@
<ion-item text-wrap button="true" lines="inset" [routerLink]="['/data-detail', item.uid]">
<ion-thumbnail slot="start">
<img src="../../../assets/imgs/logo.png">
<img class="stapps-{{item.type}}-thumbnail" src="{{item.image}}" onError="this.src='../../assets/imgs/logo.png';" alt="{{item.name}}" />
</ion-thumbnail>
<ion-label [ngSwitch]="item.type" lines="full">
<ion-label [ngSwitch]="true" lines="full">
<div>
<stapps-dish-list-item [item]="item" *ngSwitchCase="'Dish'"></stapps-dish-list-item>
<stapps-event-list-item [item]="item" *ngSwitchCase="'Event'"></stapps-event-list-item>
<span *ngSwitchDefault>
{{item.name}}<br/>
<stapps-dish-list-item [item]="item" *ngSwitchCase="item.type === 'dish'"></stapps-dish-list-item>
<stapps-place-list-item [item]="item"
*ngSwitchCase="item.type === 'building' || item.type === 'point of interest' || item.type === 'room' || item.type === 'floor'">
</stapps-place-list-item>
<stapps-event-list-item [item]="item" *ngSwitchCase="item.type === 'academic event' || item.type === 'sport course'"></stapps-event-list-item>
<stapps-person-list-item [item]="item" *ngSwitchCase="item.type === 'person'"></stapps-person-list-item>
<stapps-favorite-list-item [item]="item" *ngSwitchCase="item.type === 'favorite'"></stapps-favorite-list-item>
<stapps-catalog-list-item [item]="item" *ngSwitchCase="item.type === 'catalog'"></stapps-catalog-list-item>
<stapps-message-list-item [item]="item" *ngSwitchCase="item.type === 'message'"></stapps-message-list-item>
<stapps-date-series-list-item [item]="item" *ngSwitchCase="item.type === 'date series'"></stapps-date-series-list-item>
<stapps-article-list-item [item]="item" *ngSwitchCase="item.type === 'article'"></stapps-article-list-item>
<stapps-video-list-item [item]="item" *ngSwitchCase="item.type === 'video'"></stapps-video-list-item>
<ion-grid *ngSwitchDefault>
<ion-row>
<ion-col>
<h2 class="name">{{item.name}}</h2>
<p *ngIf="item.description">
<stapps-long-inline-text [text]="item.description" [size]="50"></stapps-long-inline-text>
</p>
<ion-note>{{item.type}}</ion-note>
</span>
</ion-col>
</ion-row>
</ion-grid>
</div>
</ion-label>
</ion-item>

View File

@@ -0,0 +1,5 @@
::ng-deep {
h2.name {
font-weight: bold !important;
}
}

View File

@@ -0,0 +1,30 @@
/*
* Copyright (C) 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.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {Component, Input} from '@angular/core';
import {SCArticle} from '@openstapps/core';
import {DataListItem} from '../../list/data-list-item.component';
@Component({
selector: 'stapps-article-list-item',
templateUrl: 'article-list-item.html',
})
export class ArticleListItem extends DataListItem {
@Input() item: SCArticle;
ngOnInit() {
// TODO: translation
}
}

View File

@@ -0,0 +1,15 @@
<ion-grid>
<ion-row>
<ion-col>
<h2 class="name">{{item.name}}</h2>
<p *ngIf="item.keywords">
<stapps-long-inline-text [text]="item.keywords.join(', ')" [size]="30"></stapps-long-inline-text>
</p>
<ion-note>
{{item.categories.join(', ')}}
</ion-note>
</ion-col>
<ion-col width-20 text-right>
</ion-col>
</ion-row>
</ion-grid>

View File

@@ -0,0 +1,30 @@
/*
* Copyright (C) 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.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {Component, Input} from '@angular/core';
import {SCCatalog} from '@openstapps/core';
import {DataListItem} from '../../list/data-list-item.component';
@Component({
selector: 'stapps-catalog-list-item',
templateUrl: 'catalog-list-item.html',
})
export class CatalogListItem extends DataListItem {
@Input() item: SCCatalog;
ngOnInit() {
// TODO: translation
}
}

View File

@@ -0,0 +1,13 @@
<ion-grid>
<ion-row>
<ion-col>
<h2 class="name">{{item.name}}</h2>
<p *ngIf="item.description">
<stapps-long-inline-text [text]="item.description" [size]="50"></stapps-long-inline-text>
</p>
<p *ngIf="item.academicTerm">{{item.academicTerm.name}}</p>
</ion-col>
<ion-col width-20 text-right>
</ion-col>
</ion-row>
</ion-grid>

View File

@@ -0,0 +1,30 @@
/*
* Copyright (C) 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.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {Component, Input} from '@angular/core';
import {SCDateSeries} from '@openstapps/core';
import {DataListItem} from '../../list/data-list-item.component';
@Component({
selector: 'stapps-date-series-list-item',
templateUrl: 'date-series-list-item.html',
})
export class DateSeriesListItem extends DataListItem {
@Input() item: SCDateSeries;
ngOnInit() {
// TODO: translation
}
}

View File

@@ -0,0 +1,15 @@
<ion-grid>
<ion-row>
<ion-col>
<h2 class="name">{{item.name}}</h2>
<p>
<ion-icon name="calendar"></ion-icon>
<span>{{item.frequency}}, {{item.dates[0] | date: 'shortDate'}} - {{item.dates[item.dates.length-1] | date: 'shortDate'}}</span>
</p>
<ion-note *ngIf="item.event.type === 'academic event'">{{item.event.categories.join(', ')}}</ion-note>
</ion-col>
<ion-col width-20 text-right>
<stapps-offers-in-list *ngIf="item.offers" [offers]="item.offers"></stapps-offers-in-list>
</ion-col>
</ion-row>
</ion-grid>

View File

@@ -14,7 +14,7 @@
*/
import {Component, Input} from '@angular/core';
import {LangChangeEvent, TranslateService} from '@ngx-translate/core';
import {SCDish, SCDishMeta, SCLanguageName, SCThingMeta} from '@openstapps/core';
import {SCDish, SCLanguageName} from '@openstapps/core';
@Component({
selector: 'stapps-dish-detail-content',
@@ -23,13 +23,11 @@ import {SCDish, SCDishMeta, SCLanguageName, SCThingMeta} from '@openstapps/core'
export class DishDetailContentComponent {
@Input() item: SCDish;
language: SCLanguageName;
meta: SCThingMeta;
objectKeys = Object.keys;
constructor(translateService: TranslateService) {
this.language = translateService.currentLang as SCLanguageName;
this.meta = SCDishMeta;
translateService.onLangChange.subscribe((event: LangChangeEvent) => {
this.language = event.lang as SCLanguageName;
});

View File

@@ -18,7 +18,7 @@
<ion-card-content>{{item.additives.join(', ')}}</ion-card-content>
</ion-card>
<ion-card *ngIf="item.place">
<!-- <ion-card *ngIf="item.place">
<ion-card-header>{{meta.getFieldTranslation(language, 'place')}}</ion-card-header>
<ion-card-content><a>{{item.place.name}}</a></ion-card-content>
</ion-card>
@@ -41,9 +41,9 @@
</ion-row>
</ion-grid>
</ion-card-content>
</ion-card>
</ion-card> -->
<!--
<ion-card *ngIf="item.availabilityStarts">
<ion-card-header>Verfügbarkeit</ion-card-header>
<ion-card-content>{{item.availabilityStarts | date}}</ion-card-content>
</ion-card>
</ion-card> -->

View File

@@ -14,12 +14,24 @@
*/
import {Component, Input} from '@angular/core';
import {SCDish} from '@openstapps/core';
// import {SettingsProvider} from '../../../settings/settings.provider';
import {DataListItem} from '../../list/data-list-item.component';
@Component({
selector: 'stapps-dish-list-item',
templateUrl: 'dish-list-item.html',
})
export class DishListItem extends DataListItem {
@Input() item: SCDish;
// settingsProvider: SettingsProvider;
// constructor(settingsProvider: SettingsProvider) {
// super();
// this.settingsProvider = settingsProvider;
// }
ngOnInit() {
// TODO: translation...
}
}

View File

@@ -1,4 +1,12 @@
{{item.name}}<br/>
<ion-note>
{{item.categories.join(',')}}
</ion-note>
<ion-grid>
<ion-row>
<ion-col>
<h2 class="name">{{item.name}}</h2>
<p>{{item.description}}</p>
<p>{{item.categories.join(',')}}</p>
</ion-col>
<ion-col width-20 text-right>
<stapps-offers-in-list ng-if="item.offers" [offers]="item.offers"></stapps-offers-in-list>
</ion-col>
</ion-row>
</ion-grid>

View File

@@ -13,7 +13,7 @@
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {Component, Input} from '@angular/core';
import {SCDateSeries} from '@openstapps/core';
import {SCAcademicEvent, SCSportCourse} from '@openstapps/core';
import {DataListItem} from '../../list/data-list-item.component';
@Component({
@@ -21,5 +21,9 @@ import {DataListItem} from '../../list/data-list-item.component';
templateUrl: 'event-list-item.html',
})
export class EventListItemComponent extends DataListItem {
@Input() item: SCDateSeries;
@Input() item: SCAcademicEvent | SCSportCourse;
ngOnInit() {
// TODO: translation
}
}

View File

@@ -1,5 +1,12 @@
{{item.name}}<br/>
<ion-note>
{{item.type}}
</ion-note>
<ion-grid>
<ion-row>
<ion-col>
<h2 class="name">{{item.name}}</h2>
<p *ngIf="item.description">{{item.description}}</p>
<p *ngIf="item.academicTerms">{{item.academicTerms[0].name}}</p>
<ion-note *ngIf="item.type === 'academic event'">{{item.categories.join(', ')}}</ion-note>
</ion-col>
<ion-col width-20 text-right>
</ion-col>
</ion-row>
</ion-grid>

View File

@@ -0,0 +1,30 @@
/*
* Copyright (C) 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.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {Component, Input} from '@angular/core';
import {SCFavorite} from '@openstapps/core';
import {DataListItem} from '../../list/data-list-item.component';
@Component({
selector: 'stapps-favorite-list-item',
templateUrl: 'favorite-list-item.html',
})
export class FavoriteListItem extends DataListItem {
@Input() item: SCFavorite;
ngOnInit() {
// TODO: translation
}
}

View File

@@ -0,0 +1,13 @@
<ion-grid>
<ion-row>
<ion-col>
<h2 class="name">{{item.name}}: {{item.data.name}}</h2>
<p *ngIf="item.data.description">
<stapps-long-inline-text [text]="item.data.description" [size]="50"></stapps-long-inline-text>
</p>
<ion-note>{{item.data.type}}</ion-note>
</ion-col>
<ion-col width-20 text-right>
</ion-col>
</ion-row>
</ion-grid>

View File

@@ -0,0 +1,30 @@
/*
* Copyright (C) 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.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {Component, Input} from '@angular/core';
import {SCMessage} from '@openstapps/core';
import {DataListItem} from '../../list/data-list-item.component';
@Component({
selector: 'stapps-message-list-item',
templateUrl: 'message-list-item.html',
})
export class MessageListItem extends DataListItem {
@Input() item: SCMessage;
ngOnInit() {
// TODO: translation
}
}

View File

@@ -0,0 +1,10 @@
<ion-grid>
<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>
</ion-col>
</ion-row>
</ion-grid>

View File

@@ -0,0 +1,30 @@
/*
* Copyright (C) 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.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {Component, Input} from '@angular/core';
import {SCOrganization} from '@openstapps/core';
import {DataListItem} from '../../list/data-list-item.component';
@Component({
selector: 'stapps-organization-list-item',
templateUrl: 'organization-list-item.html',
})
export class OrganizationListItem extends DataListItem {
@Input() item: SCOrganization;
ngOnInit() {
// TODO: translation
}
}

View File

@@ -0,0 +1,30 @@
/*
* Copyright (C) 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.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {Component, Input} from '@angular/core';
import {SCPerson} from '@openstapps/core';
import {DataListItem} from '../../list/data-list-item.component';
@Component({
selector: 'stapps-person-list-item',
templateUrl: 'person-list-item.html',
})
export class PersonListItem extends DataListItem {
@Input() item: SCPerson;
ngOnInit() {
// TODO: translation
}
}

View File

@@ -0,0 +1,13 @@
<ion-grid>
<ion-row>
<ion-col>
<h2 class="name">{{item.name}} <span ng-if="item.honorificPrefix">, {{item.honorificPrefix}}</span></h2>
<p *ngIf="item.telephone || item.email"><span *ngIf="item.telephone">
<ion-icon name="call"></ion-icon>&nbsp;{{item.telephone}}&nbsp;
</span><span *ngIf="item.email">
<ion-icon name="mail"></ion-icon>&nbsp;{{item.email}}
</span></p>
<p *ngIf="item.jobTitles">{{item.jobTitles.join(', ') | slice:0:50}}<span *ngIf="item.jobTitles.join(', ').length > 51">...</span></p>
</ion-col>
</ion-row>
</ion-grid>

View File

@@ -0,0 +1,30 @@
/*
* Copyright (C) 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.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {Component, Input} from '@angular/core';
import {SCBuilding, SCPointOfInterest, SCRoom} from '@openstapps/core';
import {DataListItem} from '../../list/data-list-item.component';
@Component({
selector: 'stapps-place-list-item',
templateUrl: 'place-list-item.html',
})
export class PlaceListItem extends DataListItem {
@Input() item: SCBuilding | SCRoom | SCPointOfInterest;
ngOnInit() {
// TODO: translation
}
}

View File

@@ -0,0 +1,12 @@
<ion-grid>
<ion-row>
<ion-col>
<h2 class="name">{{item.name}}</h2>
<p *ngIf="item.description">{{item.description}}</p>
<ion-note>{{item.type}}</ion-note>
</ion-col>
<ion-col width-20 text-right *ngIf="item.type !== 'building'">
<span *ngIf="item.inPlace"><ion-icon name="pin"></ion-icon> {{item.inPlace.name}}</span>
</ion-col>
</ion-row>
</ion-grid>

View File

@@ -0,0 +1,30 @@
/*
* Copyright (C) 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.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {Component, Input} from '@angular/core';
import {SCSemester} from '@openstapps/core';
import {DataListItem} from '../../list/data-list-item.component';
@Component({
selector: 'stapps-semester-list-item',
templateUrl: 'semester-list-item.html',
})
export class SemesterListItem extends DataListItem {
@Input() item: SCSemester;
ngOnInit() {
// TODO: translation
}
}

View File

@@ -0,0 +1,30 @@
/*
* Copyright (C) 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.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {Component, Input} from '@angular/core';
import {SCVideo} from '@openstapps/core';
import {DataListItem} from '../../list/data-list-item.component';
@Component({
selector: 'stapps-video-list-item',
templateUrl: 'video-list-item.html',
})
export class VideoListItem extends DataListItem {
@Input() item: SCVideo;
ngOnInit() {
// TODO: translation
}
}

View File

@@ -0,0 +1,9 @@
<ion-grid>
<ion-row>
<ion-col>
<h2 class="name">{{item.name}}</h2>
<p *ngIf="item.description"><stapps-long-inline-text [text]="item.description" [size]="30"></stapps-long-inline-text></p>
<ion-note>{{item.type}}</ion-note>
</ion-col>
</ion-row>
</ion-grid>

View File

@@ -1,9 +1,9 @@
<ion-card>
<ion-card-header>
<!-- <ion-card-header>
<span id="settingTitle" >{{ meta.getFieldValueTranslation(language, 'name', setting) }}</span>
</ion-card-header>
</ion-card-header> -->
<ion-card-content>
<ion-note >{{ meta.getFieldValueTranslation(language, 'description', setting) }}</ion-note>
<!-- <ion-note >{{ meta.getFieldValueTranslation(language, 'description', setting) }}</ion-note> -->
<div [ngSwitch]="setting.input.inputType" *ngIf="isVisible" >
<ion-item *ngSwitchCase="'toggle'">