diff options
author | Chocobozzz <me@florianbigard.com> | 2019-08-27 17:09:43 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-09-05 10:17:02 +0200 |
commit | 421d935d256db5b77a652d8da0c9a38cb57147ba (patch) | |
tree | 972810106cd0f620713833e65c3ec861d241d155 /client/src/app/+signup/+register/register.component.ts | |
parent | 4402b54dce0fe652ba71326f0dc74db287963260 (diff) | |
download | PeerTube-421d935d256db5b77a652d8da0c9a38cb57147ba.tar.gz PeerTube-421d935d256db5b77a652d8da0c9a38cb57147ba.tar.zst PeerTube-421d935d256db5b77a652d8da0c9a38cb57147ba.zip |
Add about information in registration page
Diffstat (limited to 'client/src/app/+signup/+register/register.component.ts')
-rw-r--r-- | client/src/app/+signup/+register/register.component.ts | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/client/src/app/+signup/+register/register.component.ts b/client/src/app/+signup/+register/register.component.ts index cd6059728..d470ef4dc 100644 --- a/client/src/app/+signup/+register/register.component.ts +++ b/client/src/app/+signup/+register/register.component.ts | |||
@@ -1,21 +1,35 @@ | |||
1 | import { Component } from '@angular/core' | 1 | import { Component, OnInit, ViewChild } from '@angular/core' |
2 | import { AuthService, Notifier, RedirectService, ServerService } from '@app/core' | 2 | import { AuthService, Notifier, RedirectService, ServerService } from '@app/core' |
3 | import { UserService, UserValidatorsService } from '@app/shared' | 3 | import { UserService, UserValidatorsService } from '@app/shared' |
4 | import { I18n } from '@ngx-translate/i18n-polyfill' | 4 | import { I18n } from '@ngx-translate/i18n-polyfill' |
5 | import { UserRegister } from '@shared/models/users/user-register.model' | 5 | import { UserRegister } from '@shared/models/users/user-register.model' |
6 | import { FormGroup } from '@angular/forms' | 6 | import { FormGroup } from '@angular/forms' |
7 | import { About } from '@shared/models/server' | ||
8 | import { InstanceService } from '@app/shared/instance/instance.service' | ||
9 | import { NgbAccordion } from '@ng-bootstrap/ng-bootstrap' | ||
7 | 10 | ||
8 | @Component({ | 11 | @Component({ |
9 | selector: 'my-register', | 12 | selector: 'my-register', |
10 | templateUrl: './register.component.html', | 13 | templateUrl: './register.component.html', |
11 | styleUrls: [ './register.component.scss' ] | 14 | styleUrls: [ './register.component.scss' ] |
12 | }) | 15 | }) |
13 | export class RegisterComponent { | 16 | export class RegisterComponent implements OnInit { |
17 | @ViewChild('accordion', { static: true }) accordion: NgbAccordion | ||
18 | |||
14 | info: string = null | 19 | info: string = null |
15 | error: string = null | 20 | error: string = null |
16 | success: string = null | 21 | success: string = null |
17 | signupDone = false | 22 | signupDone = false |
18 | 23 | ||
24 | about: About | ||
25 | aboutHtml = { | ||
26 | description: '', | ||
27 | terms: '', | ||
28 | codeOfConduct: '', | ||
29 | moderationInformation: '', | ||
30 | administrator: '' | ||
31 | } | ||
32 | |||
19 | formStepUser: FormGroup | 33 | formStepUser: FormGroup |
20 | formStepChannel: FormGroup | 34 | formStepChannel: FormGroup |
21 | 35 | ||
@@ -26,6 +40,7 @@ export class RegisterComponent { | |||
26 | private userService: UserService, | 40 | private userService: UserService, |
27 | private serverService: ServerService, | 41 | private serverService: ServerService, |
28 | private redirectService: RedirectService, | 42 | private redirectService: RedirectService, |
43 | private instanceService: InstanceService, | ||
29 | private i18n: I18n | 44 | private i18n: I18n |
30 | ) { | 45 | ) { |
31 | } | 46 | } |
@@ -34,6 +49,19 @@ export class RegisterComponent { | |||
34 | return this.serverService.getConfig().signup.requiresEmailVerification | 49 | return this.serverService.getConfig().signup.requiresEmailVerification |
35 | } | 50 | } |
36 | 51 | ||
52 | ngOnInit (): void { | ||
53 | this.instanceService.getAbout() | ||
54 | .subscribe( | ||
55 | async about => { | ||
56 | this.about = about | ||
57 | |||
58 | this.aboutHtml = await this.instanceService.buildHtml(about) | ||
59 | }, | ||
60 | |||
61 | err => this.notifier.error(err.message) | ||
62 | ) | ||
63 | } | ||
64 | |||
37 | hasSameChannelAndAccountNames () { | 65 | hasSameChannelAndAccountNames () { |
38 | return this.getUsername() === this.getChannelName() | 66 | return this.getUsername() === this.getChannelName() |
39 | } | 67 | } |
@@ -58,6 +86,14 @@ export class RegisterComponent { | |||
58 | this.formStepChannel = form | 86 | this.formStepChannel = form |
59 | } | 87 | } |
60 | 88 | ||
89 | onTermsClick () { | ||
90 | if (this.accordion) this.accordion.toggle('terms') | ||
91 | } | ||
92 | |||
93 | onCodeOfConductClick () { | ||
94 | if (this.accordion) this.accordion.toggle('code-of-conduct') | ||
95 | } | ||
96 | |||
61 | signup () { | 97 | signup () { |
62 | this.error = null | 98 | this.error = null |
63 | 99 | ||