]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/+signup/+register/register-step-terms.component.ts
improvements to login and sign-up pages (#3357)
[github/Chocobozzz/PeerTube.git] / client / src / app / +signup / +register / register-step-terms.component.ts
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 }