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) {
this.projectors = this.projectorRepo.getViewModelList();
this.updateClosProjector();
this.projectorRepo.getViewModelListObservable().subscribe(newProjectors => {
this.projectors = newProjectors;
this.updateClosProjector();
});
this.subscriptions.push(
this.projectorRepo.getViewModelListObservable().subscribe(newProjectors => {
this.projectors = newProjectors;
this.updateClosProjector();
})
);
} else {
const id = +this.route.snapshot.url[this.route.snapshot.url.length - 1].path;
this.setListOfSpeakersId(id);
@ -226,6 +228,7 @@ export class ListOfSpeakersComponent extends BaseViewComponent implements OnInit
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 => {
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;
const allSpeakers = this.viewListOfSpeakers.speakers.sort((a, b) => a.weight - b.weight);
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[];
/**
* Constructor for bas elist views
* Constructor for base list views
*
* @param titleService the title serivce, 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.
@ -96,12 +97,10 @@ export abstract class BaseViewComponent extends BaseComponent implements OnDestr
* executes the life cycle again
*/
protected cleanSubjects(): void {
if (this.subscriptions.length > 0) {
for (const sub of this.subscriptions) {
sub.unsubscribe();
}
this.subscriptions = [];
for (const sub of this.subscriptions) {
sub.unsubscribe();
}
this.subscriptions = [];
}
/**