Cleanup optionalparameter from BaseComponent
This commit is contained in:
parent
0419ea629f
commit
64eab79d3b
@ -50,12 +50,10 @@ export abstract class BaseComponent {
|
||||
link image charmap | code fullscreen`
|
||||
};
|
||||
|
||||
public constructor(protected titleService?: Title, protected translate?: TranslateService) {
|
||||
if (this.translate) {
|
||||
public constructor(protected titleService: Title, protected translate: TranslateService) {
|
||||
this.tinyMceSettings.language_url = '/assets/tinymce/langs/' + this.translate.currentLang + '.js';
|
||||
this.tinyMceSettings.language = this.translate.currentLang;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the title in web browser using angulars TitleService
|
||||
|
@ -1,4 +1,7 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { Title } from '@angular/platform-browser';
|
||||
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
|
||||
import { BaseComponent } from '../../../base.component';
|
||||
import { ViewportService } from 'app/core/ui-services/viewport.service';
|
||||
@ -15,7 +18,7 @@ export class MetaTextBlockComponent extends BaseComponent {
|
||||
@Input()
|
||||
public showActionRow: boolean;
|
||||
|
||||
public constructor(public vp: ViewportService) {
|
||||
super();
|
||||
public constructor(title: Title, translate: TranslateService, public vp: ViewportService) {
|
||||
super(title, translate);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||
import { Router, ActivatedRoute } from '@angular/router';
|
||||
import { FormGroup, Validators, FormBuilder } from '@angular/forms';
|
||||
import { Title } from '@angular/platform-browser';
|
||||
|
||||
import { Subscription } from 'rxjs';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
@ -74,7 +75,8 @@ export class LoginMaskComponent extends BaseComponent implements OnInit, OnDestr
|
||||
* @param loginDataService provide information about the legal notice and privacy policy
|
||||
*/
|
||||
public constructor(
|
||||
protected translate: TranslateService,
|
||||
title: Title,
|
||||
translate: TranslateService,
|
||||
private authService: AuthService,
|
||||
private operator: OperatorService,
|
||||
private router: Router,
|
||||
@ -84,7 +86,7 @@ export class LoginMaskComponent extends BaseComponent implements OnInit, OnDestr
|
||||
private OpenSlides: OpenSlidesService,
|
||||
private loginDataService: LoginDataService
|
||||
) {
|
||||
super();
|
||||
super(title, translate);
|
||||
this.createForm();
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,8 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { Title } from '@angular/platform-browser';
|
||||
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
|
||||
import { BaseComponent } from 'app/base.component';
|
||||
import { MotionPdfExportService } from 'app/site/motions/services/motion-pdf-export.service';
|
||||
@ -40,11 +43,13 @@ export class PersonalNoteComponent extends BaseComponent {
|
||||
* @param pdfService
|
||||
*/
|
||||
public constructor(
|
||||
title: Title,
|
||||
translate: TranslateService,
|
||||
private personalNoteService: PersonalNoteService,
|
||||
formBuilder: FormBuilder,
|
||||
private pdfService: MotionPdfExportService
|
||||
) {
|
||||
super();
|
||||
super(title, translate);
|
||||
this.personalNoteForm = formBuilder.group({
|
||||
note: ['']
|
||||
});
|
||||
|
@ -33,7 +33,7 @@
|
||||
<mat-nav-list>
|
||||
<a mat-list-item [matMenuTriggerFor]="languageMenu">
|
||||
<mat-icon>language</mat-icon>
|
||||
<span> {{ getLangName(this.translate.currentLang) }} </span>
|
||||
<span>{{ getLangName() }}</span>
|
||||
</a>
|
||||
<div *ngIf="isLoggedIn">
|
||||
<a [routerLink]="operator.user ? ['/users/', operator.user.id] : []" (click)="mobileAutoCloseNav()" mat-list-item>
|
||||
|
@ -2,6 +2,7 @@ import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { Router, NavigationEnd } from '@angular/router';
|
||||
import { FormGroup, FormControl } from '@angular/forms';
|
||||
import { MatDialog, MatSidenav } from '@angular/material';
|
||||
import { Title } from '@angular/platform-browser';
|
||||
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
|
||||
@ -57,17 +58,18 @@ export class SiteComponent extends BaseComponent implements OnInit {
|
||||
* @param timeTravel
|
||||
*/
|
||||
public constructor(
|
||||
title: Title,
|
||||
translate: TranslateService,
|
||||
private authService: AuthService,
|
||||
private router: Router,
|
||||
public operator: OperatorService,
|
||||
public vp: ViewportService,
|
||||
public translate: TranslateService,
|
||||
public dialog: MatDialog,
|
||||
public mainMenuService: MainMenuService,
|
||||
public OSStatus: OpenSlidesStatusService,
|
||||
public timeTravel: TimeTravelService
|
||||
) {
|
||||
super();
|
||||
super(title, translate);
|
||||
|
||||
this.operator.getViewUserObservable().subscribe(user => {
|
||||
if (user) {
|
||||
@ -132,8 +134,15 @@ export class SiteComponent extends BaseComponent implements OnInit {
|
||||
|
||||
/**
|
||||
* Get the name of a Language by abbreviation.
|
||||
*
|
||||
* @param abbreviation The abbreviation of the languate or null, if the current
|
||||
* language should be used.
|
||||
*/
|
||||
public getLangName(abbreviation: string): string {
|
||||
public getLangName(abbreviation?: string): string {
|
||||
if (!abbreviation) {
|
||||
abbreviation = this.translate.currentLang;
|
||||
}
|
||||
|
||||
if (abbreviation === 'en') {
|
||||
return 'English';
|
||||
} else if (abbreviation === 'de') {
|
||||
|
Loading…
Reference in New Issue
Block a user