-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #123 from uatisdeproblem/108-migrate-speakers-page
- Loading branch information
Showing
14 changed files
with
234 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<ion-header> | ||
<ion-toolbar> | ||
<ion-title>{{ 'SPEAKERS.DETAILS' | translate }}</ion-title> | ||
</ion-toolbar> | ||
</ion-header> | ||
|
||
<ion-content> | ||
<ion-grid class="contentGrid"> | ||
<ion-row class="ion-justify-content-center"> | ||
<ion-col size="12" size-md="6"> | ||
<app-speaker-card [speaker]="speaker"></app-speaker-card> | ||
</ion-col> | ||
<ion-col size="12" size-md="6"> | ||
<ion-list> | ||
<ion-list-header> | ||
<ion-label class="ion-text-center"> | ||
<h2>{{ 'SPEAKERS.SESSIONS' | translate }}</h2> | ||
</ion-label> | ||
</ion-list-header> | ||
<ion-searchbar #searchbar color="light" (ionInput)="filterSessions($event.target.value)"></ion-searchbar> | ||
<ion-col *ngIf="!sessions"> | ||
<app-session-card [preview]="true"></app-session-card> | ||
</ion-col> | ||
<ion-col *ngIf="sessions && sessions.length === 0"> | ||
<ion-item lines="none" color="white"> | ||
<ion-label class="ion-text-center">{{ 'COMMON.NO_ELEMENT_FOUND' | translate }}</ion-label> | ||
</ion-item> | ||
</ion-col> | ||
<ion-col *ngFor="let session of sessions"> | ||
<app-session-card [session]="session" [preview]="true" (click)="app.goToInTabs(['sessions', session.sessionId])"></app-session-card> | ||
</ion-col> | ||
</ion-list> | ||
</ion-col> | ||
</ion-row> | ||
</ion-grid> | ||
</ion-content> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { ActivatedRoute } from '@angular/router'; | ||
|
||
import { IDEALoadingService, IDEAMessageService } from '@idea-ionic/common'; | ||
|
||
import { AppService } from 'src/app/app.service'; | ||
import { SpeakersService } from './speakers.service'; | ||
import { SessionsService } from '../sessions/sessions.service'; | ||
|
||
import { Speaker } from '@models/speaker.model'; | ||
import { Session } from '@models/session.model'; | ||
|
||
@Component({ | ||
selector: 'app-speaker', | ||
templateUrl: './speaker.page.html', | ||
styleUrls: ['./speaker.page.scss'] | ||
}) | ||
export class SpeakerPage implements OnInit { | ||
speaker: Speaker; | ||
sessions: Session[]; | ||
|
||
constructor( | ||
private route: ActivatedRoute, | ||
private loading: IDEALoadingService, | ||
private message: IDEAMessageService, | ||
private _speakers: SpeakersService, | ||
private _sessions: SessionsService, | ||
public app: AppService | ||
) {} | ||
|
||
async ngOnInit() { | ||
await this.loadData(); | ||
} | ||
|
||
async loadData() { | ||
try { | ||
await this.loading.show(); | ||
const speakerId = this.route.snapshot.paramMap.get('speakerId'); | ||
this.speaker = await this._speakers.getById(speakerId); | ||
this.sessions = await this._sessions.getList({ speaker: this.speaker.speakerId, force: true }); | ||
} catch (err) { | ||
this.message.error('COMMON.NOT_FOUND'); | ||
} finally { | ||
await this.loading.hide(); | ||
} | ||
} | ||
|
||
async filterSessions(search: string = ''): Promise<void> { | ||
this.sessions = await this._sessions.getList({ search, speaker: this.speaker.speakerId }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
front-end/src/app/tabs/speakers/speakers-routing.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { Routes, RouterModule } from '@angular/router'; | ||
|
||
import { SpeakersPage } from './speakers.page'; | ||
import { SpeakerPage } from './speaker.page'; | ||
|
||
const routes: Routes = [ | ||
{ path: '', component: SpeakersPage }, | ||
{ path: ':speakerId', component: SpeakerPage } | ||
]; | ||
|
||
@NgModule({ | ||
imports: [RouterModule.forChild(routes)], | ||
exports: [RouterModule] | ||
}) | ||
export class SpeakersRoutingModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
import { IonicModule } from '@ionic/angular'; | ||
import { FormsModule } from '@angular/forms'; | ||
import { IDEATranslationsModule } from '@idea-ionic/common'; | ||
|
||
import { SpeakersRoutingModule } from './speakers-routing.module'; | ||
import { SpeakerPage } from './speaker.page'; | ||
import { SpeakersPage } from './speakers.page'; | ||
import { SpeakerCardStandaloneComponent } from './speakerCard.component'; | ||
import { SessionCardStandaloneComponent } from '../sessions/sessionCard.component'; | ||
|
||
@NgModule({ | ||
imports: [ | ||
CommonModule, | ||
FormsModule, | ||
IonicModule, | ||
IDEATranslationsModule, | ||
SpeakersRoutingModule, | ||
SpeakerCardStandaloneComponent, | ||
SessionCardStandaloneComponent | ||
], | ||
declarations: [SpeakersPage, SpeakerPage] | ||
}) | ||
export class SpeakersModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<ion-header> | ||
<ion-toolbar *ngIf="app.isInMobileMode()" color="ideaToolbar"> | ||
<ion-title class="ion-text-center"> | ||
{{ 'SPEAKERS.LIST' | translate }} | ||
</ion-title> | ||
</ion-toolbar> | ||
</ion-header> | ||
<ion-content> | ||
<ion-list lines="inset" style="padding: 0; max-width: 500px; margin: 0 auto;"> | ||
<ion-searchbar #searchbar color="light" (ionInput)="filterSpeakers($event.target.value)"></ion-searchbar> | ||
<ion-item color="white" class="noElements" *ngIf="speakers && !speakers.length"> | ||
<ion-label>{{ 'COMMON.NO_ELEMENT_FOUND' | translate }}</ion-label> | ||
</ion-item> | ||
<ion-item color="white" *ngIf="!speakers"> | ||
<ion-label><ion-skeleton-text animated></ion-skeleton-text></ion-label> | ||
</ion-item> | ||
<ion-item | ||
color="white" | ||
*ngFor="let speaker of speakers" | ||
button | ||
detail | ||
(click)="selectSpeaker(speaker)" | ||
> | ||
<ion-label class="ion-text-wrap">{{ speaker.name }}</ion-label> | ||
</ion-item> | ||
</ion-list> | ||
</ion-content> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { Component, OnInit, ViewChild } from '@angular/core'; | ||
import { IonContent } from '@ionic/angular'; | ||
|
||
import { Speaker } from '@models/speaker.model'; | ||
import { SpeakersService } from './speakers.service'; | ||
import { AppService } from 'src/app/app.service'; | ||
import { IDEALoadingService, IDEAMessageService } from '@idea-ionic/common'; | ||
|
||
@Component({ | ||
selector: 'app-speakers', | ||
templateUrl: './speakers.page.html', | ||
styleUrls: ['./speakers.page.scss'] | ||
}) | ||
export class SpeakersPage implements OnInit { | ||
@ViewChild(IonContent) content: IonContent; | ||
|
||
speakers: Speaker[]; | ||
filteredSpeakers: Speaker[]; | ||
|
||
constructor( | ||
private loading: IDEALoadingService, | ||
private message: IDEAMessageService, | ||
private _speakers: SpeakersService, | ||
public app: AppService | ||
) {} | ||
|
||
ngOnInit() { | ||
this.loadData(); | ||
} | ||
|
||
async loadData() { | ||
try { | ||
await this.loading.show(); | ||
this.speakers = await this._speakers.getList({}); | ||
} catch (error) { | ||
this.message.error('COMMON.OPERATION_FAILED'); | ||
} finally { | ||
this.loading.hide(); | ||
} | ||
} | ||
|
||
async filterSpeakers(search = ''): Promise<void> { | ||
this.speakers = await this._speakers.getList({ search }); | ||
} | ||
|
||
selectSpeaker(speaker: Speaker) { | ||
this.app.goToInTabs(['speakers', speaker.speakerId]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters