feat(data): add data detail templates

Additionally clean up the code
This commit is contained in:
Jovan Krunić
2019-04-10 15:01:00 +02:00
parent 75ca8c8a73
commit 5855accc16
58 changed files with 1015 additions and 91 deletions

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 {SCThings} from '@openstapps/core';
@Component({
selector: 'stapps-data-detail-content',
templateUrl: 'data-detail-content.html',
})
export class DataDetailContentComponent {
@Input() item: SCThings;
}

View File

@@ -0,0 +1,27 @@
<stapps-simple-card *ngIf="item.description" [title]="'Description'" [content]="item.description"></stapps-simple-card>
<div [ngSwitch]="true" lines="full">
<stapps-dish-detail-content [item]="item" [language]="language" *ngSwitchCase="item.type === 'dish'">
</stapps-dish-detail-content>
<stapps-place-detail-content [item]="item" [language]="language"
*ngSwitchCase="item.type === 'building' || item.type === 'point of interest' || item.type === 'room' || item.type === 'floor'">
</stapps-place-detail-content>
<stapps-event-detail-content [item]="item" [language]="language"
*ngSwitchCase="item.type === 'academic event' || item.type === 'sport course'"></stapps-event-detail-content>
<stapps-person-detail-content [item]="item" [language]="language" *ngSwitchCase="item.type === 'person'">
</stapps-person-detail-content>
<stapps-favorite-detail-content [item]="item" [language]="language" *ngSwitchCase="item.type === 'favorite'">
</stapps-favorite-detail-content>
<stapps-catalog-detail-content [item]="item" [language]="language" *ngSwitchCase="item.type === 'catalog'">
</stapps-catalog-detail-content>
<stapps-message-detail-content [item]="item" [language]="language" *ngSwitchCase="item.type === 'message'">
</stapps-message-detail-content>
<stapps-date-series-detail-content [item]="item" [language]="language" *ngSwitchCase="item.type === 'date series'">
</stapps-date-series-detail-content>
<stapps-article-detail-content [item]="item" [language]="language" *ngSwitchCase="item.type === 'article'">
</stapps-article-detail-content>
<stapps-video-detail-content [item]="item" [language]="language" *ngSwitchCase="item.type === 'video'">
</stapps-video-detail-content>
<stapps-semester-detail-content [item]="item" [language]="language" *ngSwitchCase="item.type === 'semester'">
</stapps-semester-detail-content>
<stapps-origin-detail [origin]="item.origin" ></stapps-origin-detail>
</div>

View File

@@ -15,18 +15,28 @@
import {Component} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {IonRefresher} from '@ionic/angular';
import {SCThing, SCUuid} from '@openstapps/core';
import {LangChangeEvent, TranslateService} from '@ngx-translate/core';
import {SCLanguageCode, SCThing, SCUuid} from '@openstapps/core';
import {DataProvider, DataScope} from '../data.provider';
@Component({
selector: 'stapps-data-detail',
styleUrls: ['data-detail.scss'],
templateUrl: 'data-detail.html',
})
export class DataDetailComponent {
dataProvider: DataProvider;
item: SCThing;
constructor(private route: ActivatedRoute, dataProvider: DataProvider) {
language: SCLanguageCode;
constructor(private route: ActivatedRoute, dataProvider: DataProvider, translateService: TranslateService) {
this.dataProvider = dataProvider;
this.language = translateService.currentLang as SCLanguageCode;
// alert(translateService.currentLang);
translateService.onLangChange.subscribe((event: LangChangeEvent) => {
this.language = event.lang as SCLanguageCode;
});
}
/**
* Provides data item with given UID

View File

@@ -14,12 +14,5 @@
</ion-refresher-content>
</ion-refresher>
<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> -->
<!-- <span *ngSwitchDefault>
<p *ngIf="item.description">{{item.description}}</p>
</span> -->
</div>
<stapps-data-detail-content [item]="item"></stapps-data-detail-content>
</ion-content>

View File

@@ -1,3 +1,13 @@
stapps-data-detail {
::ng-deep {
ion-card-header {
font-weight: bold;
}
}
::ng-deep {
ion-slides.work-locations {
ion-slide {
display: block; text-align: left;
}
}
}