mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-20 08:33:11 +00:00
feat(data): add data detail templates
Additionally clean up the code
This commit is contained in:
24
src/app/modules/data/detail/data-detail-content.component.ts
Normal file
24
src/app/modules/data/detail/data-detail-content.component.ts
Normal 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;
|
||||
}
|
||||
27
src/app/modules/data/detail/data-detail-content.html
Normal file
27
src/app/modules/data/detail/data-detail-content.html
Normal 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>
|
||||
@@ -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
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user