Sets the TabTitle
Motions, users and elections reset the title of a tab in their detail-view.
This commit is contained in:
parent
ea1c3437b6
commit
23fe9f1a94
@ -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) {
|
||||
|
@ -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(), [], []);
|
||||
|
@ -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;
|
||||
});
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user