Sets more tab title

Sets the titles for the tab on more pages.
Fixes #4773.
This commit is contained in:
GabrielMeyer 2019-06-17 12:11:26 +02:00
parent a5e1646f3c
commit 31161398c0
7 changed files with 27 additions and 8 deletions

View File

@ -248,6 +248,7 @@ export class ListOfSpeakersComponent extends BaseViewComponent implements OnInit
this.closSubscription = this.listOfSpeakersRepo.getViewModelObservable(id).subscribe(listOfSpeakers => { this.closSubscription = this.listOfSpeakersRepo.getViewModelObservable(id).subscribe(listOfSpeakers => {
if (listOfSpeakers) { if (listOfSpeakers) {
super.setTitle(listOfSpeakers.getTitle() + ` - ${this.translate.instant('List of speakers')}`);
this.viewListOfSpeakers = listOfSpeakers; this.viewListOfSpeakers = listOfSpeakers;
const allSpeakers = this.viewListOfSpeakers.speakers.sort((a, b) => a.weight - b.weight); const allSpeakers = this.viewListOfSpeakers.speakers.sort((a, b) => a.weight - b.weight);
this.speakers = allSpeakers.filter(speaker => speaker.state === SpeakerState.WAITING); this.speakers = allSpeakers.filter(speaker => speaker.state === SpeakerState.WAITING);

View File

@ -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 { OpenSlidesService } from 'app/core/core-services/openslides.service';
import { UpdateService } from 'app/core/ui-services/update.service'; import { UpdateService } from 'app/core/ui-services/update.service';
import { Title } from '@angular/platform-browser';
import { TranslateService } from '@ngx-translate/core';
@Component({ @Component({
selector: 'os-legal-notice', selector: 'os-legal-notice',
templateUrl: './legal-notice.component.html' templateUrl: './legal-notice.component.html'
}) })
export class LegalNoticeComponent { export class LegalNoticeComponent implements OnInit {
public constructor(private openSlidesService: OpenSlidesService, private update: UpdateService) {} 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 { public resetCache(): void {
this.openSlidesService.reset(); this.openSlidesService.reset();

View File

@ -1,4 +1,6 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { Title } from '@angular/platform-browser';
import { TranslateService } from '@ngx-translate/core';
@Component({ @Component({
selector: 'os-privacy-policy', selector: 'os-privacy-policy',
@ -6,7 +8,9 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./privacy-policy.component.scss'] styleUrls: ['./privacy-policy.component.scss']
}) })
export class PrivacyPolicyComponent implements OnInit { 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'));
}
} }

View File

@ -93,7 +93,6 @@ export class CategoryDetailComponent extends BaseViewComponent implements OnInit
* Sets the title, observes the block and the motions belonging in this block * Sets the title, observes the block and the motions belonging in this block
*/ */
public ngOnInit(): void { public ngOnInit(): void {
super.setTitle('Category');
const selectedCategoryId = parseInt(this.route.snapshot.params.id, 10); const selectedCategoryId = parseInt(this.route.snapshot.params.id, 10);
this.subscriptions.push( 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 // Find index of last child. THis can be easily done by searching, becuase this
// is the flat sorted tree // is the flat sorted tree
this.selectedCategory = categories[selectedCategoryIndex]; this.selectedCategory = categories[selectedCategoryIndex];
super.setTitle(this.selectedCategory.prefixedName);
let lastChildIndex: number; let lastChildIndex: number;
for ( for (
lastChildIndex = selectedCategoryIndex + 1; lastChildIndex = selectedCategoryIndex + 1;

View File

@ -12,9 +12,9 @@
</div> </div>
</os-head-bar> </os-head-bar>
<!-- Creating a new motion block --> <!-- Creating a new category -->
<mat-card class="os-card" *ngIf="isCreatingNewCategory"> <mat-card class="os-card" *ngIf="isCreatingNewCategory">
<mat-card-title translate>New motion block</mat-card-title> <mat-card-title>New category</mat-card-title>
<mat-card-content> <mat-card-content>
<form [formGroup]="createForm" (keydown)="onKeyDown($event)"> <form [formGroup]="createForm" (keydown)="onKeyDown($event)">
<!-- Prefix --> <!-- Prefix -->

View File

@ -123,6 +123,7 @@ export class MotionBlockDetailComponent extends BaseViewComponent implements OnI
this.subscriptions.push( this.subscriptions.push(
this.repo.getViewModelObservable(blockId).subscribe(newBlock => { this.repo.getViewModelObservable(blockId).subscribe(newBlock => {
if (newBlock) { if (newBlock) {
super.setTitle(newBlock.getTitle());
this.block = newBlock; this.block = newBlock;
this.dataSource = createDS<ViewMotion>() this.dataSource = createDS<ViewMotion>()

View File

@ -81,6 +81,7 @@ export class PasswordComponent extends BaseViewComponent implements OnInit {
* Initializes the forms and some of the frontend options * Initializes the forms and some of the frontend options
*/ */
public ngOnInit(): void { public ngOnInit(): void {
super.setTitle(this.translate.instant('Change password'));
this.route.params.subscribe(params => { this.route.params.subscribe(params => {
if (params.id) { if (params.id) {
this.urlUserId = +params.id; this.urlUserId = +params.id;