diff options
Diffstat (limited to 'client/src/app/+about/about-instance/about-instance.component.ts')
-rw-r--r-- | client/src/app/+about/about-instance/about-instance.component.ts | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/client/src/app/+about/about-instance/about-instance.component.ts b/client/src/app/+about/about-instance/about-instance.component.ts index 354f52ce7..a1b30fa8c 100644 --- a/client/src/app/+about/about-instance/about-instance.component.ts +++ b/client/src/app/+about/about-instance/about-instance.component.ts | |||
@@ -1,23 +1,26 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnInit, ViewChild } from '@angular/core' |
2 | import { ServerService } from '@app/core' | 2 | import { Notifier, 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' | 3 | import { I18n } from '@ngx-translate/i18n-polyfill' |
4 | import { ContactAdminModalComponent } from '@app/+about/about-instance/contact-admin-modal.component' | ||
5 | import { InstanceService } from '@app/shared/instance/instance.service' | ||
6 | import { MarkdownService } from '@app/shared/renderer' | ||
6 | 7 | ||
7 | @Component({ | 8 | @Component({ |
8 | selector: 'my-about-instance', | 9 | selector: 'my-about-instance', |
9 | templateUrl: './about-instance.component.html', | 10 | templateUrl: './about-instance.component.html', |
10 | styleUrls: [ './about-instance.component.scss' ] | 11 | styleUrls: [ './about-instance.component.scss' ] |
11 | }) | 12 | }) |
12 | |||
13 | export class AboutInstanceComponent implements OnInit { | 13 | export class AboutInstanceComponent implements OnInit { |
14 | @ViewChild('contactAdminModal') contactAdminModal: ContactAdminModalComponent | ||
15 | |||
14 | shortDescription = '' | 16 | shortDescription = '' |
15 | descriptionHTML = '' | 17 | descriptionHTML = '' |
16 | termsHTML = '' | 18 | termsHTML = '' |
17 | 19 | ||
18 | constructor ( | 20 | constructor ( |
19 | private notificationsService: NotificationsService, | 21 | private notifier: Notifier, |
20 | private serverService: ServerService, | 22 | private serverService: ServerService, |
23 | private instanceService: InstanceService, | ||
21 | private markdownService: MarkdownService, | 24 | private markdownService: MarkdownService, |
22 | private i18n: I18n | 25 | private i18n: I18n |
23 | ) {} | 26 | ) {} |
@@ -34,8 +37,12 @@ export class AboutInstanceComponent implements OnInit { | |||
34 | return this.serverService.getConfig().signup.allowed | 37 | return this.serverService.getConfig().signup.allowed |
35 | } | 38 | } |
36 | 39 | ||
40 | get isContactFormEnabled () { | ||
41 | return this.serverService.getConfig().email.enabled && this.serverService.getConfig().contactForm.enabled | ||
42 | } | ||
43 | |||
37 | ngOnInit () { | 44 | ngOnInit () { |
38 | this.serverService.getAbout() | 45 | this.instanceService.getAbout() |
39 | .subscribe( | 46 | .subscribe( |
40 | res => { | 47 | res => { |
41 | this.shortDescription = res.instance.shortDescription | 48 | this.shortDescription = res.instance.shortDescription |
@@ -43,8 +50,12 @@ export class AboutInstanceComponent implements OnInit { | |||
43 | this.termsHTML = this.markdownService.textMarkdownToHTML(res.instance.terms) | 50 | this.termsHTML = this.markdownService.textMarkdownToHTML(res.instance.terms) |
44 | }, | 51 | }, |
45 | 52 | ||
46 | err => this.notificationsService.error(this.i18n('Error getting about from server'), err) | 53 | () => this.notifier.error(this.i18n('Cannot get about information from server')) |
47 | ) | 54 | ) |
48 | } | 55 | } |
49 | 56 | ||
57 | openContactModal () { | ||
58 | return this.contactAdminModal.show() | ||
59 | } | ||
60 | |||
50 | } | 61 | } |