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