diff options
Diffstat (limited to 'client/src/app/+signup')
6 files changed, 153 insertions, 22 deletions
diff --git a/client/src/app/+signup/+register/register-step-user.component.html b/client/src/app/+signup/+register/register-step-user.component.html index 47b3be8cc..4381702ae 100644 --- a/client/src/app/+signup/+register/register-step-user.component.html +++ b/client/src/app/+signup/+register/register-step-user.component.html | |||
@@ -60,11 +60,16 @@ | |||
60 | </div> | 60 | </div> |
61 | 61 | ||
62 | <div class="form-group form-group-terms"> | 62 | <div class="form-group form-group-terms"> |
63 | <my-peertube-checkbox | 63 | <my-peertube-checkbox inputName="terms" formControlName="terms"> |
64 | inputName="terms" formControlName="terms" | 64 | <ng-template ptTemplate="label"> |
65 | i18n-labelHtml | 65 | <ng-container i18n> |
66 | labelHtml="I am at least 16 years old and agree to the <a href='/about/instance#terms-section' target='_blank'rel='noopener noreferrer'>Terms</a> of this instance" | 66 | I am at least 16 years old and agree |
67 | ></my-peertube-checkbox> | 67 | to the <a (click)="onTermsClick($event)" href='#'>Terms</a> |
68 | <ng-container *ngIf="hasCodeOfConduct"> and to the <a (click)="onCodeOfConductClick($event)" href='#'>Code of Conduct</a></ng-container> | ||
69 | of this instance | ||
70 | </ng-container> | ||
71 | </ng-template> | ||
72 | </my-peertube-checkbox> | ||
68 | 73 | ||
69 | <div *ngIf="formErrors.terms" class="form-error"> | 74 | <div *ngIf="formErrors.terms" class="form-error"> |
70 | {{ formErrors.terms }} | 75 | {{ formErrors.terms }} |
diff --git a/client/src/app/+signup/+register/register-step-user.component.ts b/client/src/app/+signup/+register/register-step-user.component.ts index 3b71fd3c4..6c96f20b4 100644 --- a/client/src/app/+signup/+register/register-step-user.component.ts +++ b/client/src/app/+signup/+register/register-step-user.component.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { Component, EventEmitter, OnInit, Output } from '@angular/core' | 1 | import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core' |
2 | import { AuthService } from '@app/core' | 2 | import { AuthService } from '@app/core' |
3 | import { FormReactive, UserService, UserValidatorsService } from '@app/shared' | 3 | import { FormReactive, UserService, UserValidatorsService } from '@app/shared' |
4 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' | 4 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' |
@@ -12,7 +12,11 @@ import { concat, of } from 'rxjs' | |||
12 | styleUrls: [ './register.component.scss' ] | 12 | styleUrls: [ './register.component.scss' ] |
13 | }) | 13 | }) |
14 | export class RegisterStepUserComponent extends FormReactive implements OnInit { | 14 | export class RegisterStepUserComponent extends FormReactive implements OnInit { |
15 | @Input() hasCodeOfConduct = false | ||
16 | |||
15 | @Output() formBuilt = new EventEmitter<FormGroup>() | 17 | @Output() formBuilt = new EventEmitter<FormGroup>() |
18 | @Output() termsClick = new EventEmitter<void>() | ||
19 | @Output() codeOfConductClick = new EventEmitter<void>() | ||
16 | 20 | ||
17 | constructor ( | 21 | constructor ( |
18 | protected formValidatorService: FormValidatorService, | 22 | protected formValidatorService: FormValidatorService, |
@@ -45,6 +49,16 @@ export class RegisterStepUserComponent extends FormReactive implements OnInit { | |||
45 | .subscribe(([ oldValue, newValue ]) => this.onDisplayNameChange(oldValue, newValue)) | 49 | .subscribe(([ oldValue, newValue ]) => this.onDisplayNameChange(oldValue, newValue)) |
46 | } | 50 | } |
47 | 51 | ||
52 | onTermsClick (event: Event) { | ||
53 | event.preventDefault() | ||
54 | this.termsClick.emit() | ||
55 | } | ||
56 | |||
57 | onCodeOfConductClick (event: Event) { | ||
58 | event.preventDefault() | ||
59 | this.codeOfConductClick.emit() | ||
60 | } | ||
61 | |||
48 | private onDisplayNameChange (oldDisplayName: string, newDisplayName: string) { | 62 | private onDisplayNameChange (oldDisplayName: string, newDisplayName: string) { |
49 | const username = this.form.value['username'] || '' | 63 | const username = this.form.value['username'] || '' |
50 | 64 | ||
diff --git a/client/src/app/+signup/+register/register.component.html b/client/src/app/+signup/+register/register.component.html index d7e47c1a8..e7440fe1e 100644 --- a/client/src/app/+signup/+register/register.component.html +++ b/client/src/app/+signup/+register/register.component.html | |||
@@ -7,11 +7,15 @@ | |||
7 | <my-signup-success *ngIf="signupDone" [message]="success"></my-signup-success> | 7 | <my-signup-success *ngIf="signupDone" [message]="success"></my-signup-success> |
8 | <div *ngIf="info" class="alert alert-info">{{ info }}</div> | 8 | <div *ngIf="info" class="alert alert-info">{{ info }}</div> |
9 | 9 | ||
10 | <div class="wrapper" *ngIf="!signupDone"> | 10 | <div class="wrapper" [hidden]="signupDone"> |
11 | <div> | 11 | <div class="register-form"> |
12 | <my-custom-stepper linear *ngIf="!signupDone"> | 12 | <my-custom-stepper linear *ngIf="!signupDone"> |
13 | <cdk-step [stepControl]="formStepUser" i18n-label label="User information"> | 13 | <cdk-step [stepControl]="formStepUser" i18n-label label="User information"> |
14 | <my-register-step-user (formBuilt)="onUserFormBuilt($event)"></my-register-step-user> | 14 | <my-register-step-user |
15 | [hasCodeOfConduct]="!!aboutHtml.codeOfConduct" | ||
16 | (formBuilt)="onUserFormBuilt($event)" (termsClick)="onTermsClick()" (codeOfConductClick)="onCodeOfConductClick()" | ||
17 | > | ||
18 | </my-register-step-user> | ||
15 | 19 | ||
16 | <button i18n cdkStepperNext [disabled]="!formStepUser || !formStepUser.valid">Next</button> | 20 | <button i18n cdkStepperNext [disabled]="!formStepUser || !formStepUser.valid">Next</button> |
17 | </cdk-step> | 21 | </cdk-step> |
@@ -38,9 +42,56 @@ | |||
38 | </my-custom-stepper> | 42 | </my-custom-stepper> |
39 | </div> | 43 | </div> |
40 | 44 | ||
41 | <div> | 45 | <div class="instance-information"> |
42 | <label i18n>Features found on this instance</label> | 46 | <ngb-accordion [closeOthers]="true" #accordion="ngbAccordion"> |
43 | <my-instance-features-table></my-instance-features-table> | 47 | <ngb-panel id="instance-features" i18n-title title="Features found on this instance"> |
48 | <ng-template ngbPanelContent> | ||
49 | <my-instance-features-table></my-instance-features-table> | ||
50 | </ng-template> | ||
51 | </ngb-panel> | ||
52 | |||
53 | <ng-container *ngIf="about"> | ||
54 | <ngb-panel | ||
55 | *ngIf="aboutHtml.administrator || about.instance.maintenanceLifetime || about.instance.businessModel" | ||
56 | id="admin-sustainability" i18n-title title="Administrators & Sustainability" | ||
57 | > | ||
58 | <ng-template ngbPanelContent> | ||
59 | <div class="block"> | ||
60 | <strong i18n>Who are we?</strong> | ||
61 | <div [innerHTML]="aboutHtml.administrator"></div> | ||
62 | </div> | ||
63 | |||
64 | <div class="block"> | ||
65 | <strong i18n>How long do we plan to maintain this instance?</strong> | ||
66 | <div [innerHTML]="about.instance.maintenanceLifetime"></div> | ||
67 | </div> | ||
68 | |||
69 | <div class="block"> | ||
70 | <strong i18n>How will we pay this instance?</strong> | ||
71 | <div [innerHTML]="about.instance.businessModel"></div> | ||
72 | </div> | ||
73 | </ng-template> | ||
74 | </ngb-panel> | ||
75 | |||
76 | <ngb-panel *ngIf="aboutHtml.moderationInformation" id="moderation-information" i18n-title title="Moderation information"> | ||
77 | <ng-template ngbPanelContent> | ||
78 | <div class="block" [innerHTML]="aboutHtml.moderationInformation"></div> | ||
79 | </ng-template> | ||
80 | </ngb-panel> | ||
81 | |||
82 | <ngb-panel *ngIf="aboutHtml.codeOfConduct" id="code-of-conduct" i18n-title title="Code of conduct"> | ||
83 | <ng-template ngbPanelContent> | ||
84 | <div class="block" [innerHTML]="aboutHtml.codeOfConduct"></div> | ||
85 | </ng-template> | ||
86 | </ngb-panel> | ||
87 | |||
88 | <ngb-panel *ngIf="aboutHtml.terms" id="terms" i18n-title title="Terms"> | ||
89 | <ng-template ngbPanelContent> | ||
90 | <div class="block" [innerHTML]="aboutHtml.terms"></div> | ||
91 | </ng-template> | ||
92 | </ngb-panel> | ||
93 | </ng-container> | ||
94 | </ngb-accordion> | ||
44 | </div> | 95 | </div> |
45 | </div> | 96 | </div> |
46 | 97 | ||
diff --git a/client/src/app/+signup/+register/register.component.scss b/client/src/app/+signup/+register/register.component.scss index 9405b5293..2f62dd59d 100644 --- a/client/src/app/+signup/+register/register.component.scss +++ b/client/src/app/+signup/+register/register.component.scss | |||
@@ -1,5 +1,9 @@ | |||
1 | @import '_variables'; | 1 | @import '_variables'; |
2 | @import '_mixins'; | 2 | @import '_mixins'; |
3 | @import "./_bootstrap-variables"; | ||
4 | |||
5 | @import '~bootstrap/scss/functions'; | ||
6 | @import '~bootstrap/scss/variables'; | ||
3 | 7 | ||
4 | .alert { | 8 | .alert { |
5 | font-size: 15px; | 9 | font-size: 15px; |
@@ -13,7 +17,32 @@ | |||
13 | 17 | ||
14 | & > div { | 18 | & > div { |
15 | margin-bottom: 40px; | 19 | margin-bottom: 40px; |
16 | width: 450px; | 20 | |
21 | &.register-form { | ||
22 | width: 450px; | ||
23 | } | ||
24 | |||
25 | &.instance-information { | ||
26 | width: 600px; | ||
27 | margin-bottom: 40px; | ||
28 | |||
29 | .block { | ||
30 | font-size: 15px; | ||
31 | margin-bottom: 15px; | ||
32 | padding: 0 $btn-padding-x; | ||
33 | } | ||
34 | |||
35 | @media screen and (max-width: 1500px) { | ||
36 | width: 450px; | ||
37 | } | ||
38 | |||
39 | ngb-accordion ::ng-deep { | ||
40 | .btn { | ||
41 | font-weight: $font-semibold !important; | ||
42 | color: var(--mainForegroundColor) !important; | ||
43 | } | ||
44 | } | ||
45 | } | ||
17 | 46 | ||
18 | @media screen and (max-width: 500px) { | 47 | @media screen and (max-width: 500px) { |
19 | width: auto; | 48 | width: auto; |
@@ -21,12 +50,6 @@ | |||
21 | } | 50 | } |
22 | } | 51 | } |
23 | 52 | ||
24 | my-instance-features-table { | ||
25 | display: block; | ||
26 | |||
27 | margin-bottom: 40px; | ||
28 | } | ||
29 | |||
30 | .form-group-terms { | 53 | .form-group-terms { |
31 | margin: 30px 0; | 54 | margin: 30px 0; |
32 | } | 55 | } |
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 | ||
diff --git a/client/src/app/+signup/+register/register.module.ts b/client/src/app/+signup/+register/register.module.ts index 46336cbd0..e55f83990 100644 --- a/client/src/app/+signup/+register/register.module.ts +++ b/client/src/app/+signup/+register/register.module.ts | |||
@@ -7,13 +7,15 @@ import { RegisterStepChannelComponent } from './register-step-channel.component' | |||
7 | import { RegisterStepUserComponent } from './register-step-user.component' | 7 | import { RegisterStepUserComponent } from './register-step-user.component' |
8 | import { CustomStepperComponent } from './custom-stepper.component' | 8 | import { CustomStepperComponent } from './custom-stepper.component' |
9 | import { SignupSharedModule } from '@app/+signup/shared/signup-shared.module' | 9 | import { SignupSharedModule } from '@app/+signup/shared/signup-shared.module' |
10 | import { NgbAccordionModule } from '@ng-bootstrap/ng-bootstrap' | ||
10 | 11 | ||
11 | @NgModule({ | 12 | @NgModule({ |
12 | imports: [ | 13 | imports: [ |
13 | RegisterRoutingModule, | 14 | RegisterRoutingModule, |
14 | SharedModule, | 15 | SharedModule, |
15 | CdkStepperModule, | 16 | CdkStepperModule, |
16 | SignupSharedModule | 17 | SignupSharedModule, |
18 | NgbAccordionModule | ||
17 | ], | 19 | ], |
18 | 20 | ||
19 | declarations: [ | 21 | declarations: [ |