]>
Commit | Line | Data |
---|---|---|
734a5ceb | 1 | import { Component, OnInit, OnDestroy } from '@angular/core' |
db400f44 | 2 | import { ActivatedRoute } from '@angular/router' |
0626e7af C |
3 | import { Account } from '@app/shared/account/account.model' |
4 | import { AccountService } from '@app/shared/account/account.service' | |
b1d40cff | 5 | import { I18n } from '@ngx-translate/i18n-polyfill' |
734a5ceb | 6 | import { Subscription } from 'rxjs' |
53055a11 | 7 | import { MarkdownService } from '@app/videos/shared' |
0626e7af C |
8 | |
9 | @Component({ | |
10 | selector: 'my-account-about', | |
11 | templateUrl: './account-about.component.html', | |
12 | styleUrls: [ './account-about.component.scss' ] | |
13 | }) | |
734a5ceb | 14 | export class AccountAboutComponent implements OnInit, OnDestroy { |
6b738c7a | 15 | account: Account |
53055a11 | 16 | descriptionHTML = '' |
0626e7af | 17 | |
734a5ceb C |
18 | private accountSub: Subscription |
19 | ||
0626e7af | 20 | constructor ( |
b1d40cff C |
21 | private route: ActivatedRoute, |
22 | private i18n: I18n, | |
53055a11 C |
23 | private accountService: AccountService, |
24 | private markdownService: MarkdownService | |
0626e7af C |
25 | ) { } |
26 | ||
27 | ngOnInit () { | |
28 | // Parent get the account for us | |
734a5ceb | 29 | this.accountSub = this.accountService.accountLoaded |
53055a11 C |
30 | .subscribe(account => { |
31 | this.account = account | |
32 | this.descriptionHTML = this.markdownService.textMarkdownToHTML(this.account.description) | |
33 | }) | |
0626e7af C |
34 | } |
35 | ||
734a5ceb C |
36 | ngOnDestroy () { |
37 | if (this.accountSub) this.accountSub.unsubscribe() | |
38 | } | |
39 | ||
0626e7af | 40 | getAccountDescription () { |
53055a11 | 41 | if (this.descriptionHTML) return this.descriptionHTML |
0626e7af | 42 | |
b1d40cff | 43 | return this.i18n('No description') |
0626e7af C |
44 | } |
45 | } |