Sets always the title 'Current LOS' if current LOS

This commit is contained in:
GabrielMeyer 2019-09-18 10:11:24 +02:00
parent a688bd0ffe
commit 9e407006f6
2 changed files with 16 additions and 11 deletions

View File

@ -164,10 +164,12 @@ export class ListOfSpeakersComponent extends BaseViewComponent implements OnInit
if (this.isCurrentListOfSpeakers) { if (this.isCurrentListOfSpeakers) {
this.projectors = this.projectorRepo.getViewModelList(); this.projectors = this.projectorRepo.getViewModelList();
this.updateClosProjector(); this.updateClosProjector();
this.subscriptions.push(
this.projectorRepo.getViewModelListObservable().subscribe(newProjectors => { this.projectorRepo.getViewModelListObservable().subscribe(newProjectors => {
this.projectors = newProjectors; this.projectors = newProjectors;
this.updateClosProjector(); this.updateClosProjector();
}); })
);
} else { } else {
const id = +this.route.snapshot.url[this.route.snapshot.url.length - 1].path; const id = +this.route.snapshot.url[this.route.snapshot.url.length - 1].path;
this.setListOfSpeakersId(id); this.setListOfSpeakersId(id);
@ -226,6 +228,7 @@ export class ListOfSpeakersComponent extends BaseViewComponent implements OnInit
this.setListOfSpeakersId(listOfSpeakers.id); this.setListOfSpeakersId(listOfSpeakers.id);
} }
}); });
this.subscriptions.push(this.projectorSubscription);
} }
/** /**
@ -247,7 +250,10 @@ export class ListOfSpeakersComponent extends BaseViewComponent implements OnInit
this.closSubscription = this.listOfSpeakersRepo.getViewModelObservable(id).subscribe(listOfSpeakers => { this.closSubscription = this.listOfSpeakersRepo.getViewModelObservable(id).subscribe(listOfSpeakers => {
if (listOfSpeakers) { if (listOfSpeakers) {
super.setTitle(listOfSpeakers.getTitle() + ` - ${this.translate.instant('List of speakers')}`); const title = this.isCurrentListOfSpeakers
? 'Current list of speakers'
: listOfSpeakers.getTitle() + ` - ${this.translate.instant('List of speakers')}`;
super.setTitle(title);
this.viewListOfSpeakers = listOfSpeakers; this.viewListOfSpeakers = listOfSpeakers;
const allSpeakers = this.viewListOfSpeakers.speakers.sort((a, b) => a.weight - b.weight); const allSpeakers = this.viewListOfSpeakers.speakers.sort((a, b) => a.weight - b.weight);
this.speakers = allSpeakers.filter(speaker => speaker.state === SpeakerState.WAITING); this.speakers = allSpeakers.filter(speaker => speaker.state === SpeakerState.WAITING);

View File

@ -24,7 +24,8 @@ export abstract class BaseViewComponent extends BaseComponent implements OnDestr
protected subscriptions: Subscription[]; protected subscriptions: Subscription[];
/** /**
* Constructor for bas elist views * Constructor for base list views
*
* @param titleService the title serivce, passed to the base component * @param titleService the title serivce, passed to the base component
* @param translate the translate service, passed to the base component * @param translate the translate service, passed to the base component
* @param matSnackBar the snack bar service. Needed for showing errors. * @param matSnackBar the snack bar service. Needed for showing errors.
@ -96,13 +97,11 @@ export abstract class BaseViewComponent extends BaseComponent implements OnDestr
* executes the life cycle again * executes the life cycle again
*/ */
protected cleanSubjects(): void { protected cleanSubjects(): void {
if (this.subscriptions.length > 0) {
for (const sub of this.subscriptions) { for (const sub of this.subscriptions) {
sub.unsubscribe(); sub.unsubscribe();
} }
this.subscriptions = []; this.subscriptions = [];
} }
}
/** /**
* Translate alternative avoid endless loops during change detection * Translate alternative avoid endless loops during change detection