2018-07-04 17:51:31 +02:00
|
|
|
import { Injector } from '@angular/core';
|
2018-06-19 16:55:50 +02:00
|
|
|
import { Title } from '@angular/platform-browser';
|
2018-07-12 14:11:31 +02:00
|
|
|
import { OpenSlidesComponent } from './openslides.component';
|
2018-06-19 16:55:50 +02:00
|
|
|
|
2018-07-12 14:11:31 +02:00
|
|
|
/**
|
|
|
|
* Provides functionalities that will be used by most components
|
|
|
|
* currently able to set the title with the suffix ' - OpenSlides 3'
|
|
|
|
*
|
|
|
|
* A BaseComponent is an OpenSlides Component.
|
|
|
|
* Components in the 'Side'- or 'projector' Folder are BaseComponents
|
|
|
|
*/
|
|
|
|
export abstract class BaseComponent extends OpenSlidesComponent {
|
|
|
|
/**
|
|
|
|
* To manipulate the browser title bar, adds the Suffix "OpenSlides 3"
|
|
|
|
*
|
|
|
|
* Might be a config variable later at some point
|
|
|
|
*/
|
2018-06-19 16:55:50 +02:00
|
|
|
private titleSuffix = ' - OpenSlides 3';
|
|
|
|
|
2018-07-12 14:11:31 +02:00
|
|
|
/**
|
|
|
|
* Child constructor that implements the titleServices and calls Super from OpenSlidesComponent
|
|
|
|
*/
|
2018-07-04 17:51:31 +02:00
|
|
|
constructor(protected titleService?: Title) {
|
2018-07-12 14:11:31 +02:00
|
|
|
super();
|
2018-07-04 17:51:31 +02:00
|
|
|
}
|
2018-06-19 16:55:50 +02:00
|
|
|
|
2018-07-12 14:11:31 +02:00
|
|
|
/**
|
|
|
|
* Set the title in web browser using angulars TitleService
|
|
|
|
* @param prefix The title prefix. Should be translated here.
|
|
|
|
* TODO Might translate the prefix here?
|
|
|
|
*/
|
|
|
|
setTitle(prefix: string): void {
|
2018-06-19 16:55:50 +02:00
|
|
|
this.titleService.setTitle(prefix + this.titleSuffix);
|
|
|
|
}
|
|
|
|
}
|