]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/+signup/+register/steps/register-step-terms.component.ts
2df963b30d86dce101562716e169b125caf4ab7c
[github/Chocobozzz/PeerTube.git] / client / src / app / +signup / +register / steps / register-step-terms.component.ts
1 import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'
2 import { FormGroup } from '@angular/forms'
3 import { USER_TERMS_VALIDATOR } from '@app/shared/form-validators/user-validators'
4 import { FormReactive, FormReactiveService } from '@app/shared/shared-forms'
5
6 @Component({
7 selector: 'my-register-step-terms',
8 templateUrl: './register-step-terms.component.html',
9 styleUrls: [ './step.component.scss' ]
10 })
11 export class RegisterStepTermsComponent extends FormReactive implements OnInit {
12 @Input() hasCodeOfConduct = false
13 @Input() minimumAge = 16
14
15 @Output() formBuilt = new EventEmitter<FormGroup>()
16 @Output() termsClick = new EventEmitter<void>()
17 @Output() codeOfConductClick = new EventEmitter<void>()
18
19 constructor (
20 protected formReactiveService: FormReactiveService
21 ) {
22 super()
23 }
24
25 get instanceHost () {
26 return window.location.host
27 }
28
29 ngOnInit () {
30 this.buildForm({
31 terms: USER_TERMS_VALIDATOR
32 })
33
34 setTimeout(() => this.formBuilt.emit(this.form))
35 }
36
37 onTermsClick (event: Event) {
38 event.preventDefault()
39 this.termsClick.emit()
40 }
41
42 onCodeOfConductClick (event: Event) {
43 event.preventDefault()
44 this.codeOfConductClick.emit()
45 }
46 }