set feature variables from ts environment

pull/47/head
HardiReady 2018-10-20 16:16:11 +02:00
parent ee1bdba661
commit ce1004a94f
6 changed files with 15 additions and 8 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "opt-cc", "name": "opt-cc",
"version": "1.8.3", "version": "1.8.4",
"author": "Florian Hartwich <hardi@noarch.de>", "author": "Florian Hartwich <hardi@noarch.de>",
"private": true, "private": true,
"scripts": { "scripts": {

View File

@ -98,15 +98,15 @@
<li *ngIf="!loginService.isLoggedIn()" routerLinkActive="active"> <li *ngIf="!loginService.isLoggedIn()" routerLinkActive="active">
<a routerLink='{{config.loginPath}}' class="link">{{'navigation.top.login' | translate}}</a> <a routerLink='{{config.loginPath}}' class="link">{{'navigation.top.login' | translate}}</a>
</li> </li>
<li class="dropdown" *ngIf="FEATURE_LOCALIZATION_ENABLED"> <li class="dropdown" *ngIf="features.localization">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
aria-expanded="false" style="padding: 12px 12px 10px 12px;"> aria-expanded="false" style="padding: 12px 12px 10px 12px;">
<mat-icon svgIcon="{{(language === 'de') ? 'flag-de' : 'flag-gb'}}"></mat-icon> <mat-icon svgIcon="flag-{{language}}"></mat-icon>
<span class="caret"></span> <span class="caret"></span>
</a> </a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li *ngFor="let lang of languages" style="cursor: pointer"> <li *ngFor="let lang of languages" style="cursor: pointer">
<a (click)="setLanguage(lang)"><mat-icon svgIcon="{{(lang === 'de') ? 'flag-de' : 'flag-gb'}}"></mat-icon></a> <a (click)="setLanguage(lang)"><mat-icon svgIcon="flag-{{lang}}"></mat-icon></a>
</li> </li>
</ul> </ul>
</li> </li>

View File

@ -10,6 +10,7 @@ import {MatIconRegistry} from '@angular/material';
import {SpinnerService} from './services/user-interface/spinner/spinner.service'; import {SpinnerService} from './services/user-interface/spinner/spinner.service';
import {TranslateService} from '@ngx-translate/core'; import {TranslateService} from '@ngx-translate/core';
import {SettingsService} from './services/settings.service'; import {SettingsService} from './services/settings.service';
import {environment} from '../environments/environment';
declare function require(url: string); declare function require(url: string);
@ -20,7 +21,7 @@ declare function require(url: string);
}) })
export class AppComponent implements OnInit { export class AppComponent implements OnInit {
readonly FEATURE_LOCALIZATION_ENABLED = false; readonly features = environment.features;
config = RouteConfig; config = RouteConfig;
@ -59,7 +60,7 @@ export class AppComponent implements OnInit {
'vehicleLight': 'stats/scoreboard/vehicleLight', 'vehicleLight': 'stats/scoreboard/vehicleLight',
// --------LOCALE--------- // --------LOCALE---------
'flag-de': 'locale/de', 'flag-de': 'locale/de',
'flag-gb': 'locale/gb', 'flag-en': 'locale/en',
}; };
language; language;

View File

Before

Width:  |  Height:  |  Size: 831 B

After

Width:  |  Height:  |  Size: 831 B

View File

@ -1,4 +1,7 @@
export const environment = { export const environment = {
production: true, production: true,
e2eMode: false e2eMode: false,
features: {
localization: false
}
}; };

View File

@ -5,5 +5,8 @@
export const environment = { export const environment = {
production: false, production: false,
e2eMode: false e2eMode: false,
features: {
localization: true
}
}; };