From 31161398c0d8a74b907bb6866422b30c9f85501f Mon Sep 17 00:00:00 2001 From: GabrielMeyer Date: Mon, 17 Jun 2019 12:11:26 +0200 Subject: [PATCH] Sets more tab title Sets the titles for the tab on more pages. Fixes #4773. --- .../list-of-speakers.component.ts | 1 + .../legal-notice/legal-notice.component.ts | 17 ++++++++++++++--- .../privacy-policy/privacy-policy.component.ts | 8 ++++++-- .../category-detail.component.ts | 3 ++- .../category-list/category-list.component.html | 4 ++-- .../motion-block-detail.component.ts | 1 + .../components/password/password.component.ts | 1 + 7 files changed, 27 insertions(+), 8 deletions(-) diff --git a/client/src/app/site/agenda/components/list-of-speakers/list-of-speakers.component.ts b/client/src/app/site/agenda/components/list-of-speakers/list-of-speakers.component.ts index d56dcf083..439af4deb 100644 --- a/client/src/app/site/agenda/components/list-of-speakers/list-of-speakers.component.ts +++ b/client/src/app/site/agenda/components/list-of-speakers/list-of-speakers.component.ts @@ -248,6 +248,7 @@ 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')}`); this.viewListOfSpeakers = listOfSpeakers; const allSpeakers = this.viewListOfSpeakers.speakers.sort((a, b) => a.weight - b.weight); this.speakers = allSpeakers.filter(speaker => speaker.state === SpeakerState.WAITING); diff --git a/client/src/app/site/common/components/legal-notice/legal-notice.component.ts b/client/src/app/site/common/components/legal-notice/legal-notice.component.ts index 240596add..3bc75188f 100644 --- a/client/src/app/site/common/components/legal-notice/legal-notice.component.ts +++ b/client/src/app/site/common/components/legal-notice/legal-notice.component.ts @@ -1,13 +1,24 @@ -import { Component } from '@angular/core'; +import { Component, OnInit } from '@angular/core'; import { OpenSlidesService } from 'app/core/core-services/openslides.service'; import { UpdateService } from 'app/core/ui-services/update.service'; +import { Title } from '@angular/platform-browser'; +import { TranslateService } from '@ngx-translate/core'; @Component({ selector: 'os-legal-notice', templateUrl: './legal-notice.component.html' }) -export class LegalNoticeComponent { - public constructor(private openSlidesService: OpenSlidesService, private update: UpdateService) {} +export class LegalNoticeComponent implements OnInit { + public constructor( + private openSlidesService: OpenSlidesService, + private update: UpdateService, + private titleService: Title, + private translate: TranslateService + ) {} + + public ngOnInit(): void { + this.titleService.setTitle(this.translate.instant('Legal notice')); + } public resetCache(): void { this.openSlidesService.reset(); diff --git a/client/src/app/site/common/components/privacy-policy/privacy-policy.component.ts b/client/src/app/site/common/components/privacy-policy/privacy-policy.component.ts index fb81e8f37..2843eaed9 100644 --- a/client/src/app/site/common/components/privacy-policy/privacy-policy.component.ts +++ b/client/src/app/site/common/components/privacy-policy/privacy-policy.component.ts @@ -1,4 +1,6 @@ import { Component, OnInit } from '@angular/core'; +import { Title } from '@angular/platform-browser'; +import { TranslateService } from '@ngx-translate/core'; @Component({ selector: 'os-privacy-policy', @@ -6,7 +8,9 @@ import { Component, OnInit } from '@angular/core'; styleUrls: ['./privacy-policy.component.scss'] }) export class PrivacyPolicyComponent implements OnInit { - public constructor() {} + public constructor(private titleService: Title, private translate: TranslateService) {} - public ngOnInit(): void {} + public ngOnInit(): void { + this.titleService.setTitle(this.translate.instant('Privacy policy')); + } } diff --git a/client/src/app/site/motions/modules/category/components/category-detail/category-detail.component.ts b/client/src/app/site/motions/modules/category/components/category-detail/category-detail.component.ts index 29e5730bc..1a4a43abc 100644 --- a/client/src/app/site/motions/modules/category/components/category-detail/category-detail.component.ts +++ b/client/src/app/site/motions/modules/category/components/category-detail/category-detail.component.ts @@ -93,7 +93,6 @@ export class CategoryDetailComponent extends BaseViewComponent implements OnInit * Sets the title, observes the block and the motions belonging in this block */ public ngOnInit(): void { - super.setTitle('Category'); const selectedCategoryId = parseInt(this.route.snapshot.params.id, 10); this.subscriptions.push( @@ -108,6 +107,8 @@ export class CategoryDetailComponent extends BaseViewComponent implements OnInit // Find index of last child. THis can be easily done by searching, becuase this // is the flat sorted tree this.selectedCategory = categories[selectedCategoryIndex]; + super.setTitle(this.selectedCategory.prefixedName); + let lastChildIndex: number; for ( lastChildIndex = selectedCategoryIndex + 1; diff --git a/client/src/app/site/motions/modules/category/components/category-list/category-list.component.html b/client/src/app/site/motions/modules/category/components/category-list/category-list.component.html index 848042a96..83a35265b 100644 --- a/client/src/app/site/motions/modules/category/components/category-list/category-list.component.html +++ b/client/src/app/site/motions/modules/category/components/category-list/category-list.component.html @@ -12,9 +12,9 @@ - + - New motion block + New category
diff --git a/client/src/app/site/motions/modules/motion-block/components/motion-block-detail/motion-block-detail.component.ts b/client/src/app/site/motions/modules/motion-block/components/motion-block-detail/motion-block-detail.component.ts index e1402330c..a66f4ab7b 100644 --- a/client/src/app/site/motions/modules/motion-block/components/motion-block-detail/motion-block-detail.component.ts +++ b/client/src/app/site/motions/modules/motion-block/components/motion-block-detail/motion-block-detail.component.ts @@ -123,6 +123,7 @@ export class MotionBlockDetailComponent extends BaseViewComponent implements OnI this.subscriptions.push( this.repo.getViewModelObservable(blockId).subscribe(newBlock => { if (newBlock) { + super.setTitle(newBlock.getTitle()); this.block = newBlock; this.dataSource = createDS() diff --git a/client/src/app/site/users/components/password/password.component.ts b/client/src/app/site/users/components/password/password.component.ts index 8053cd732..995b53e24 100644 --- a/client/src/app/site/users/components/password/password.component.ts +++ b/client/src/app/site/users/components/password/password.component.ts @@ -81,6 +81,7 @@ export class PasswordComponent extends BaseViewComponent implements OnInit { * Initializes the forms and some of the frontend options */ public ngOnInit(): void { + super.setTitle(this.translate.instant('Change password')); this.route.params.subscribe(params => { if (params.id) { this.urlUserId = +params.id;