]>
Commit | Line | Data |
---|---|---|
1 | import { Component, OnInit } from '@angular/core' | |
2 | import { ServerService } from '@app/core' | |
3 | import { MarkdownService } from '@app/videos/shared' | |
4 | import { NotificationsService } from 'angular2-notifications' | |
5 | import { I18n } from '@ngx-translate/i18n-polyfill' | |
6 | ||
7 | @Component({ | |
8 | selector: 'my-about', | |
9 | templateUrl: './about.component.html', | |
10 | styleUrls: [ './about.component.scss' ] | |
11 | }) | |
12 | ||
13 | export class AboutComponent implements OnInit { | |
14 | shortDescription = '' | |
15 | descriptionHTML = '' | |
16 | termsHTML = '' | |
17 | ||
18 | constructor ( | |
19 | private notificationsService: NotificationsService, | |
20 | private serverService: ServerService, | |
21 | private markdownService: MarkdownService, | |
22 | private i18n: I18n | |
23 | ) {} | |
24 | ||
25 | get instanceName () { | |
26 | return this.serverService.getConfig().instance.name | |
27 | } | |
28 | ||
29 | get userVideoQuota () { | |
30 | return this.serverService.getConfig().user.videoQuota | |
31 | } | |
32 | ||
33 | get isSignupAllowed () { | |
34 | return this.serverService.getConfig().signup.allowed | |
35 | } | |
36 | ||
37 | ngOnInit () { | |
38 | this.serverService.getAbout() | |
39 | .subscribe( | |
40 | res => { | |
41 | this.shortDescription = res.instance.shortDescription | |
42 | this.descriptionHTML = this.markdownService.textMarkdownToHTML(res.instance.description) | |
43 | this.termsHTML = this.markdownService.textMarkdownToHTML(res.instance.terms) | |
44 | }, | |
45 | ||
46 | err => this.notificationsService.error(this.i18n('Error getting about from server'), err) | |
47 | ) | |
48 | } | |
49 | ||
50 | } |