Merge pull request #5037 from GabrielInTheWorld/alwaysTheSameTitle

Sets always the title 'Current LOS' if current LOS
This commit is contained in:
GabrielInTheWorld 2019-09-23 18:18:47 +02:00 committed by GitHub
commit 534f2d1835
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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.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,13 +97,11 @@ 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 = [];
}
}
/**
* Translate alternative avoid endless loops during change detection