From 23fe9f1a94f7af2dbf203a5e01ede7d45a9424b7 Mon Sep 17 00:00:00 2001 From: GabrielMeyer Date: Tue, 4 Jun 2019 12:04:02 +0200 Subject: [PATCH] Sets the TabTitle Motions, users and elections reset the title of a tab in their detail-view. --- .../components/topic-detail/topic-detail.component.ts | 3 +++ .../assignment-detail/assignment-detail.component.ts | 3 +++ .../components/category-list/category-list.component.ts | 2 +- .../components/motion-detail/motion-detail.component.ts | 3 +++ .../projector-detail/projector-detail.component.ts | 9 +++++++-- .../components/user-detail/user-detail.component.ts | 3 +++ 6 files changed, 20 insertions(+), 3 deletions(-) diff --git a/client/src/app/site/agenda/components/topic-detail/topic-detail.component.ts b/client/src/app/site/agenda/components/topic-detail/topic-detail.component.ts index 095e76cf7..5d689bd28 100644 --- a/client/src/app/site/agenda/components/topic-detail/topic-detail.component.ts +++ b/client/src/app/site/agenda/components/topic-detail/topic-detail.component.ts @@ -168,6 +168,7 @@ export class TopicDetailComponent extends BaseViewComponent { this.newTopic = true; this.editTopic = true; this.topic = new ViewTopic(new Topic()); + super.setTitle('New topic'); } else { // load existing topic this.route.params.subscribe(params => { @@ -186,6 +187,8 @@ export class TopicDetailComponent extends BaseViewComponent { // repo sometimes delivers undefined values // also ensures edition cannot be interrupted by autoupdate if (newViewTopic && !this.editTopic) { + const title = newViewTopic.getTitle(); + super.setTitle(title); this.topic = newViewTopic; // personalInfoForm is undefined during 'new' and directly after reloading if (this.topicForm && !this.editTopic) { diff --git a/client/src/app/site/assignments/components/assignment-detail/assignment-detail.component.ts b/client/src/app/site/assignments/components/assignment-detail/assignment-detail.component.ts index d160a6395..a4df90e3a 100644 --- a/client/src/app/site/assignments/components/assignment-detail/assignment-detail.component.ts +++ b/client/src/app/site/assignments/components/assignment-detail/assignment-detail.component.ts @@ -366,6 +366,8 @@ export class AssignmentDetailComponent extends BaseViewComponent implements OnIn this.subscriptions.push( this.repo.getViewModelObservable(assignmentId).subscribe(assignment => { if (assignment) { + const title = assignment.getTitle(); + super.setTitle(title); this.assignment = assignment; if (!this.editAssignment) { this.patchForm(this.assignment); @@ -382,6 +384,7 @@ export class AssignmentDetailComponent extends BaseViewComponent implements OnIn }) ); } else { + super.setTitle('New election'); this.newAssignment = true; // TODO set defaults? this.assignment = new ViewAssignment(new Assignment(), [], []); diff --git a/client/src/app/site/motions/modules/category/components/category-list/category-list.component.ts b/client/src/app/site/motions/modules/category/components/category-list/category-list.component.ts index f51aa36bc..e3bfbc9ba 100644 --- a/client/src/app/site/motions/modules/category/components/category-list/category-list.component.ts +++ b/client/src/app/site/motions/modules/category/components/category-list/category-list.component.ts @@ -100,7 +100,7 @@ export class CategoryListComponent extends BaseViewComponent implements OnInit { * Sets the title and gets/observes categories from DataStore */ public ngOnInit(): void { - super.setTitle('Category'); + super.setTitle('Categories'); this.repo.getViewModelListObservable().subscribe(newViewCategories => { this.categories = newViewCategories; }); diff --git a/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.ts b/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.ts index 8e6ae03e4..a08668d75 100644 --- a/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.ts +++ b/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.ts @@ -609,6 +609,8 @@ export class MotionDetailComponent extends BaseViewComponent implements OnInit, this.subscriptions.push( this.repo.getViewModelObservable(motionId).subscribe(motion => { if (motion) { + const title = motion.getTitle(); + super.setTitle(title); this.motion = motion; this.newStateExtension = this.motion.stateExtension; if (!this.editMotion) { @@ -630,6 +632,7 @@ export class MotionDetailComponent extends BaseViewComponent implements OnInit, }) ); } else { + super.setTitle('New motion'); // new motion this.newMotion = true; this.editMotion = true; diff --git a/client/src/app/site/projector/components/projector-detail/projector-detail.component.ts b/client/src/app/site/projector/components/projector-detail/projector-detail.component.ts index a9c4c0627..1bd6c1222 100644 --- a/client/src/app/site/projector/components/projector-detail/projector-detail.component.ts +++ b/client/src/app/site/projector/components/projector-detail/projector-detail.component.ts @@ -88,10 +88,15 @@ export class ProjectorDetailComponent extends BaseViewComponent implements OnIni * Gets the projector and subscribes to it. */ public ngOnInit(): void { - super.setTitle('Projector'); this.route.params.subscribe(params => { const projectorId = parseInt(params.id, 10) || 1; - this.repo.getViewModelObservable(projectorId).subscribe(projector => (this.projector = projector)); + this.repo.getViewModelObservable(projectorId).subscribe(projector => { + if (projector) { + const title = projector.name; + super.setTitle(title); + this.projector = projector; + } + }); }); } diff --git a/client/src/app/site/users/components/user-detail/user-detail.component.ts b/client/src/app/site/users/components/user-detail/user-detail.component.ts index f271687ba..c4263d9cf 100644 --- a/client/src/app/site/users/components/user-detail/user-detail.component.ts +++ b/client/src/app/site/users/components/user-detail/user-detail.component.ts @@ -121,6 +121,7 @@ export class UserDetailComponent extends BaseViewComponent implements OnInit { }); this.user = new ViewUser(new User(defaultUser)); if (route.snapshot.url[0] && route.snapshot.url[0].path === 'new') { + super.setTitle('New participant'); this.newUser = true; this.setEditMode(true); } else { @@ -214,6 +215,8 @@ export class UserDetailComponent extends BaseViewComponent implements OnInit { // repo sometimes delivers undefined values // also ensures edition cannot be interrupted by autoupdate if (newViewUser && !this.editUser) { + const title = newViewUser.getTitle(); + super.setTitle(title); this.user = newViewUser; // personalInfoForm is undefined during 'new' and directly after reloading if (this.personalInfoForm) {