diff options
Diffstat (limited to 'client/src/app/+signup/+register/register-step-terms.component.ts')
-rw-r--r-- | client/src/app/+signup/+register/register-step-terms.component.ts | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/client/src/app/+signup/+register/register-step-terms.component.ts b/client/src/app/+signup/+register/register-step-terms.component.ts new file mode 100644 index 000000000..db834c68d --- /dev/null +++ b/client/src/app/+signup/+register/register-step-terms.component.ts | |||
@@ -0,0 +1,47 @@ | |||
1 | import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core' | ||
2 | import { FormGroup } from '@angular/forms' | ||
3 | import { | ||
4 | USER_TERMS_VALIDATOR | ||
5 | } from '@app/shared/form-validators/user-validators' | ||
6 | import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' | ||
7 | |||
8 | @Component({ | ||
9 | selector: 'my-register-step-terms', | ||
10 | templateUrl: './register-step-terms.component.html', | ||
11 | styleUrls: [ './register.component.scss' ] | ||
12 | }) | ||
13 | export class RegisterStepTermsComponent extends FormReactive implements OnInit { | ||
14 | @Input() hasCodeOfConduct = false | ||
15 | |||
16 | @Output() formBuilt = new EventEmitter<FormGroup>() | ||
17 | @Output() termsClick = new EventEmitter<void>() | ||
18 | @Output() codeOfConductClick = new EventEmitter<void>() | ||
19 | |||
20 | constructor ( | ||
21 | protected formValidatorService: FormValidatorService | ||
22 | ) { | ||
23 | super() | ||
24 | } | ||
25 | |||
26 | get instanceHost () { | ||
27 | return window.location.host | ||
28 | } | ||
29 | |||
30 | ngOnInit () { | ||
31 | this.buildForm({ | ||
32 | terms: USER_TERMS_VALIDATOR | ||
33 | }) | ||
34 | |||
35 | setTimeout(() => this.formBuilt.emit(this.form)) | ||
36 | } | ||
37 | |||
38 | onTermsClick (event: Event) { | ||
39 | event.preventDefault() | ||
40 | this.termsClick.emit() | ||
41 | } | ||
42 | |||
43 | onCodeOfConductClick (event: Event) { | ||
44 | event.preventDefault() | ||
45 | this.codeOfConductClick.emit() | ||
46 | } | ||
47 | } | ||