Skip to content

Commit

Permalink
Fixes neojato#29
Browse files Browse the repository at this point in the history
  • Loading branch information
MrCsabaToth committed Oct 1, 2018
1 parent 3d099eb commit e0c9694
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<!-- Post data -->
<h2 class="text-center" style="padding-bottom: 20px;" [innerHTML]="session?.title"></h2>
<h6 class="text-muted" style="padding-bottom: 20px;">
<span *ngIf="section?.title"><strong>Section:</strong>&nbsp;<span [innerHTML]="section?.title"></span><br></span>
<span *ngIf="session?.time"><strong>Time:</strong>&nbsp;<span [innerHTML]="session?.time"></span><br></span>
<span *ngIf="session?.room"><strong>Room:</strong>&nbsp;<span [innerHTML]="session?.room"></span><br></span>
<span *ngIf="session?.level"><strong>Level:</strong>&nbsp;<span [innerHTML]="session?.level"></span><br></span>
Expand Down
9 changes: 9 additions & 0 deletions src/app/sessions/session-detail/session-detail.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ import { SiteConfigService } from './../../admin/shared/site-config/site-config.
import { Title } from '@angular/platform-browser';
import { SpeakerService } from './../../speakers/shared/speaker.service';
import { SessionService } from './../shared/session.service';
import { SectionService } from './../shared/section.service';
import { AuthService } from './../../services/auth/auth.service';
import { Component, OnInit } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { Session } from '../../sessions/shared/session';
import { Section } from '../../sessions/shared/section';

@Component({
selector: 'app-session-detail',
Expand All @@ -17,6 +19,8 @@ import { Session } from '../../sessions/shared/session';
})
export class SessionDetailComponent implements OnInit {
session: Session = new Session();
section: Section = new Section();

profiles: any[];
siteConfig: FirebaseObjectObservable<SiteConfig>;
eventName: string;
Expand All @@ -27,6 +31,7 @@ export class SessionDetailComponent implements OnInit {
private activatedRouter: ActivatedRoute,
private authService: AuthService,
private sessionService: SessionService,
private sectionService: SectionService,
private speakerService: SpeakerService,
private title: Title,
private siteConfigService: SiteConfigService,
Expand Down Expand Up @@ -55,6 +60,10 @@ export class SessionDetailComponent implements OnInit {
}
this.title.setTitle(pageTitle);
this.mySchedule = this.scheduleService.getScheduleSession(this.authService.userId, this.session.$key);

this.sectionService.getSection(session.section).subscribe(section => {
this.section = section;
});
});
});
}
Expand Down
10 changes: 9 additions & 1 deletion src/app/sessions/shared/section.service.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { Section } from './section';
import { Injectable } from '@angular/core';
import { firebaseConfig } from './../../../environments/firebase.config';
import { AngularFireDatabase, FirebaseListObservable } from 'angularfire2/database-deprecated';
import { AngularFireDatabase, FirebaseListObservable, FirebaseObjectObservable } from 'angularfire2/database-deprecated';

@Injectable()
export class SectionService {
private basePath: string = firebaseConfig.devfestYear + '/sections';
sections: FirebaseListObservable<Section[]> = null;
section: FirebaseObjectObservable<Section> = null;

constructor(private db: AngularFireDatabase) { }

Expand All @@ -14,6 +16,12 @@ export class SectionService {
return this.sections;
}

getSection(key: string): FirebaseObjectObservable<Section> {
const path = `${this.basePath}/${key}`;
this.section = this.db.object(path);
return this.section;
}

createSection(section: Section): void {
const list = this.listPath();
list.push(section);
Expand Down

0 comments on commit e0c9694

Please sign in to comment.