Skip to content

Commit

Permalink
Fixed raw template
Browse files Browse the repository at this point in the history
  • Loading branch information
sinedied committed Feb 21, 2018
1 parent d06ade4 commit 8e4f5b7
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Component, OnInit } from '@angular/core';

@Component({
selector: 'app-shell',
templateUrl: './shell.component.html',
styleUrls: ['./shell.component.scss']
})
export class ShellComponent implements OnInit {

constructor() { }

ngOnInit() { }

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { Component, OnInit } from '@angular/core';
<% if (props.auth) { -%>
import { Router } from '@angular/router';

import { AuthenticationService } from '../../authentication/authentication.service';
<% } else { -%>

<% } -%>
import { I18nService } from '../../i18n.service';

@Component({
Expand All @@ -11,38 +15,40 @@ import { I18nService } from '../../i18n.service';
})
export class HeaderComponent implements OnInit {

menuHidden = true;

constructor(private router: Router,
private authenticationService: AuthenticationService,
private i18nService: I18nService) { }
<% if (props.auth) { -%>
constructor(private router: Router,
private authenticationService: AuthenticationService,
private i18nService: I18nService) { }
<% } else { -%>
constructor(private i18nService: I18nService) { }
<% } -%>

ngOnInit() { }
ngOnInit() { }

toggleMenu() {
this.menuHidden = !this.menuHidden;
}

setLanguage(language: string) {
this.i18nService.language = language;
}
setLanguage(language: string) {
this.i18nService.language = language;
}

logout() {
this.authenticationService.logout()
.subscribe(() => this.router.navigate(['/login'], { replaceUrl: true }));
}
<% if (props.auth) { -%>
logout() {
this.authenticationService.logout()
.subscribe(() => this.router.navigate(['/login'], { replaceUrl: true }));
}

get currentLanguage(): string {
return this.i18nService.language;
}
<% } -%>
get currentLanguage(): string {
return this.i18nService.language;
}

get languages(): string[] {
return this.i18nService.supportedLanguages;
}
get languages(): string[] {
return this.i18nService.supportedLanguages;
}

get username(): string | null {
const credentials = this.authenticationService.credentials;
return credentials ? credentials.username : null;
}
<% if (props.auth) { -%>
get username(): string | null {
const credentials = this.authenticationService.credentials;
return credentials ? credentials.username : null;
}

<% } -%>
}

0 comments on commit 8e4f5b7

Please sign in to comment.