aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+my-account
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-06-05 15:01:45 +0200
committerChocobozzz <me@florianbigard.com>2018-06-05 15:02:27 +0200
commite309822b93d9b69f30cbe830ef3d09dfdb2c13b2 (patch)
tree41dbc3b3108ced7fdba4062974e568695c30e486 /client/src/app/+my-account
parentd4d5853e65e584ca51c718f8df590b987f981047 (diff)
downloadPeerTube-e309822b93d9b69f30cbe830ef3d09dfdb2c13b2.tar.gz
PeerTube-e309822b93d9b69f30cbe830ef3d09dfdb2c13b2.tar.zst
PeerTube-e309822b93d9b69f30cbe830ef3d09dfdb2c13b2.zip
Add form validator translations
Diffstat (limited to 'client/src/app/+my-account')
-rw-r--r--client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.ts8
-rw-r--r--client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.html32
-rw-r--r--client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.scss5
-rw-r--r--client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.ts8
-rw-r--r--client/src/app/+my-account/my-account-video-channels/my-account-video-channel-create.component.ts13
-rw-r--r--client/src/app/+my-account/my-account-video-channels/my-account-video-channel-update.component.ts13
6 files changed, 42 insertions, 37 deletions
diff --git a/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.ts b/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.ts
index 56e644f39..7be7aabc2 100644
--- a/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.ts
+++ b/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.ts
@@ -1,8 +1,9 @@
1import { Component, OnInit } from '@angular/core' 1import { Component, OnInit } from '@angular/core'
2import { NotificationsService } from 'angular2-notifications' 2import { NotificationsService } from 'angular2-notifications'
3import { FormReactive, USER_PASSWORD, UserService } from '../../../shared' 3import { FormReactive, UserService } from '../../../shared'
4import { I18n } from '@ngx-translate/i18n-polyfill' 4import { I18n } from '@ngx-translate/i18n-polyfill'
5import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' 5import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service'
6import { UserValidatorsService } from '@app/shared/forms/form-validators/user-validators.service'
6 7
7@Component({ 8@Component({
8 selector: 'my-account-change-password', 9 selector: 'my-account-change-password',
@@ -14,6 +15,7 @@ export class MyAccountChangePasswordComponent extends FormReactive implements On
14 15
15 constructor ( 16 constructor (
16 protected formValidatorService: FormValidatorService, 17 protected formValidatorService: FormValidatorService,
18 private userValidatorsService: UserValidatorsService,
17 private notificationsService: NotificationsService, 19 private notificationsService: NotificationsService,
18 private userService: UserService, 20 private userService: UserService,
19 private i18n: I18n 21 private i18n: I18n
@@ -23,8 +25,8 @@ export class MyAccountChangePasswordComponent extends FormReactive implements On
23 25
24 ngOnInit () { 26 ngOnInit () {
25 this.buildForm({ 27 this.buildForm({
26 'new-password': USER_PASSWORD, 28 'new-password': this.userValidatorsService.USER_PASSWORD,
27 'new-confirmed-password': USER_PASSWORD 29 'new-confirmed-password': this.userValidatorsService.USER_PASSWORD
28 }) 30 })
29 } 31 }
30 32
diff --git a/client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.html b/client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.html
index bbdce5b02..05c0b5ddc 100644
--- a/client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.html
+++ b/client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.html
@@ -2,22 +2,26 @@
2 2
3<form role="form" (ngSubmit)="updateMyProfile()" [formGroup]="form"> 3<form role="form" (ngSubmit)="updateMyProfile()" [formGroup]="form">
4 4
5 <label i18n for="display-name">Display name</label> 5 <div class="form-group">
6 <input 6 <label i18n for="display-name">Display name</label>
7 type="text" id="display-name" 7 <input
8 formControlName="display-name" [ngClass]="{ 'input-error': formErrors['display-name'] }" 8 type="text" id="display-name"
9 > 9 formControlName="display-name" [ngClass]="{ 'input-error': formErrors['display-name'] }"
10 <div *ngIf="formErrors['display-name']" class="form-error"> 10 >
11 {{ formErrors['display-name'] }} 11 <div *ngIf="formErrors['display-name']" class="form-error">
12 {{ formErrors['display-name'] }}
13 </div>
12 </div> 14 </div>
13 15
14 <label i18n for="description">Description</label> 16 <div class="form-group">
15 <textarea 17 <label i18n for="description">Description</label>
16 id="description" formControlName="description" 18 <textarea
17 [ngClass]="{ 'input-error': formErrors['description'] }" 19 id="description" formControlName="description"
18 ></textarea> 20 [ngClass]="{ 'input-error': formErrors['description'] }"
19 <div *ngIf="formErrors.description" class="form-error"> 21 ></textarea>
20 {{ formErrors.description }} 22 <div *ngIf="formErrors.description" class="form-error">
23 {{ formErrors.description }}
24 </div>
21 </div> 25 </div>
22 26
23 <input type="submit" i18n-value value="Update my profile" [disabled]="!form.valid"> 27 <input type="submit" i18n-value value="Update my profile" [disabled]="!form.valid">
diff --git a/client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.scss b/client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.scss
index fc2b92c89..6aabb60f4 100644
--- a/client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.scss
+++ b/client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.scss
@@ -1,11 +1,14 @@
1@import '_variables'; 1@import '_variables';
2@import '_mixins'; 2@import '_mixins';
3 3
4.form-group:first-child {
5 margin-bottom: 15px;
6}
7
4input[type=text] { 8input[type=text] {
5 @include peertube-input-text(340px); 9 @include peertube-input-text(340px);
6 10
7 display: block; 11 display: block;
8 margin-bottom: 15px;
9} 12}
10 13
11textarea { 14textarea {
diff --git a/client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.ts b/client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.ts
index 1fe337da0..400c3b889 100644
--- a/client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.ts
+++ b/client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.ts
@@ -1,10 +1,11 @@
1import { Component, Input, OnInit } from '@angular/core' 1import { Component, Input, OnInit } from '@angular/core'
2import { NotificationsService } from 'angular2-notifications' 2import { NotificationsService } from 'angular2-notifications'
3import { FormReactive, USER_DESCRIPTION, USER_DISPLAY_NAME, UserService } from '../../../shared' 3import { FormReactive, UserService } from '../../../shared'
4import { User } from '@app/shared' 4import { User } from '@app/shared'
5import { I18n } from '@ngx-translate/i18n-polyfill' 5import { I18n } from '@ngx-translate/i18n-polyfill'
6import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' 6import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service'
7import { Subject } from 'rxjs/Subject' 7import { Subject } from 'rxjs/Subject'
8import { UserValidatorsService } from '@app/shared/forms/form-validators/user-validators.service'
8 9
9@Component({ 10@Component({
10 selector: 'my-account-profile', 11 selector: 'my-account-profile',
@@ -19,6 +20,7 @@ export class MyAccountProfileComponent extends FormReactive implements OnInit {
19 20
20 constructor ( 21 constructor (
21 protected formValidatorService: FormValidatorService, 22 protected formValidatorService: FormValidatorService,
23 private userValidatorsService: UserValidatorsService,
22 private notificationsService: NotificationsService, 24 private notificationsService: NotificationsService,
23 private userService: UserService, 25 private userService: UserService,
24 private i18n: I18n 26 private i18n: I18n
@@ -28,8 +30,8 @@ export class MyAccountProfileComponent extends FormReactive implements OnInit {
28 30
29 ngOnInit () { 31 ngOnInit () {
30 this.buildForm({ 32 this.buildForm({
31 'display-name': USER_DISPLAY_NAME, 33 'display-name': this.userValidatorsService.USER_DISPLAY_NAME,
32 description: USER_DESCRIPTION 34 description: this.userValidatorsService.USER_DESCRIPTION
33 }) 35 })
34 36
35 this.userInformationLoaded.subscribe(() => { 37 this.userInformationLoaded.subscribe(() => {
diff --git a/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-create.component.ts b/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-create.component.ts
index e38eaae9c..c0eaa4763 100644
--- a/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-create.component.ts
+++ b/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-create.component.ts
@@ -3,15 +3,11 @@ import { Router } from '@angular/router'
3import { NotificationsService } from 'angular2-notifications' 3import { NotificationsService } from 'angular2-notifications'
4import { MyAccountVideoChannelEdit } from './my-account-video-channel-edit' 4import { MyAccountVideoChannelEdit } from './my-account-video-channel-edit'
5import { VideoChannelCreate } from '../../../../../shared/models/videos' 5import { VideoChannelCreate } from '../../../../../shared/models/videos'
6import {
7 VIDEO_CHANNEL_DESCRIPTION,
8 VIDEO_CHANNEL_DISPLAY_NAME,
9 VIDEO_CHANNEL_SUPPORT
10} from '@app/shared/forms/form-validators/video-channel'
11import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' 6import { VideoChannelService } from '@app/shared/video-channel/video-channel.service'
12import { AuthService } from '@app/core' 7import { AuthService } from '@app/core'
13import { I18n } from '@ngx-translate/i18n-polyfill' 8import { I18n } from '@ngx-translate/i18n-polyfill'
14import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' 9import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service'
10import { VideoChannelValidatorsService } from '@app/shared/forms/form-validators/video-channel-validators.service'
15 11
16@Component({ 12@Component({
17 selector: 'my-account-video-channel-create', 13 selector: 'my-account-video-channel-create',
@@ -24,6 +20,7 @@ export class MyAccountVideoChannelCreateComponent extends MyAccountVideoChannelE
24 constructor ( 20 constructor (
25 protected formValidatorService: FormValidatorService, 21 protected formValidatorService: FormValidatorService,
26 private authService: AuthService, 22 private authService: AuthService,
23 private videoChannelValidatorsService: VideoChannelValidatorsService,
27 private notificationsService: NotificationsService, 24 private notificationsService: NotificationsService,
28 private router: Router, 25 private router: Router,
29 private videoChannelService: VideoChannelService, 26 private videoChannelService: VideoChannelService,
@@ -34,9 +31,9 @@ export class MyAccountVideoChannelCreateComponent extends MyAccountVideoChannelE
34 31
35 ngOnInit () { 32 ngOnInit () {
36 this.buildForm({ 33 this.buildForm({
37 'display-name': VIDEO_CHANNEL_DISPLAY_NAME, 34 'display-name': this.videoChannelValidatorsService.VIDEO_CHANNEL_DISPLAY_NAME,
38 description: VIDEO_CHANNEL_DESCRIPTION, 35 description: this.videoChannelValidatorsService.VIDEO_CHANNEL_DESCRIPTION,
39 support: VIDEO_CHANNEL_SUPPORT 36 support: this.videoChannelValidatorsService.VIDEO_CHANNEL_SUPPORT
40 }) 37 })
41 } 38 }
42 39
diff --git a/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-update.component.ts b/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-update.component.ts
index eda03374a..1510c5015 100644
--- a/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-update.component.ts
+++ b/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-update.component.ts
@@ -3,17 +3,13 @@ import { ActivatedRoute, Router } from '@angular/router'
3import { NotificationsService } from 'angular2-notifications' 3import { NotificationsService } from 'angular2-notifications'
4import { MyAccountVideoChannelEdit } from './my-account-video-channel-edit' 4import { MyAccountVideoChannelEdit } from './my-account-video-channel-edit'
5import { VideoChannelUpdate } from '../../../../../shared/models/videos' 5import { VideoChannelUpdate } from '../../../../../shared/models/videos'
6import {
7 VIDEO_CHANNEL_DESCRIPTION,
8 VIDEO_CHANNEL_DISPLAY_NAME,
9 VIDEO_CHANNEL_SUPPORT
10} from '@app/shared/forms/form-validators/video-channel'
11import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' 6import { VideoChannelService } from '@app/shared/video-channel/video-channel.service'
12import { Subscription } from 'rxjs' 7import { Subscription } from 'rxjs'
13import { VideoChannel } from '@app/shared/video-channel/video-channel.model' 8import { VideoChannel } from '@app/shared/video-channel/video-channel.model'
14import { AuthService } from '@app/core' 9import { AuthService } from '@app/core'
15import { I18n } from '@ngx-translate/i18n-polyfill' 10import { I18n } from '@ngx-translate/i18n-polyfill'
16import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' 11import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service'
12import { VideoChannelValidatorsService } from '@app/shared/forms/form-validators/video-channel-validators.service'
17 13
18@Component({ 14@Component({
19 selector: 'my-account-video-channel-update', 15 selector: 'my-account-video-channel-update',
@@ -29,6 +25,7 @@ export class MyAccountVideoChannelUpdateComponent extends MyAccountVideoChannelE
29 constructor ( 25 constructor (
30 protected formValidatorService: FormValidatorService, 26 protected formValidatorService: FormValidatorService,
31 private authService: AuthService, 27 private authService: AuthService,
28 private videoChannelValidatorsService: VideoChannelValidatorsService,
32 private notificationsService: NotificationsService, 29 private notificationsService: NotificationsService,
33 private router: Router, 30 private router: Router,
34 private route: ActivatedRoute, 31 private route: ActivatedRoute,
@@ -40,9 +37,9 @@ export class MyAccountVideoChannelUpdateComponent extends MyAccountVideoChannelE
40 37
41 ngOnInit () { 38 ngOnInit () {
42 this.buildForm({ 39 this.buildForm({
43 'display-name': VIDEO_CHANNEL_DISPLAY_NAME, 40 'display-name': this.videoChannelValidatorsService.VIDEO_CHANNEL_DISPLAY_NAME,
44 description: VIDEO_CHANNEL_DESCRIPTION, 41 description: this.videoChannelValidatorsService.VIDEO_CHANNEL_DESCRIPTION,
45 support: VIDEO_CHANNEL_SUPPORT 42 support: this.videoChannelValidatorsService.VIDEO_CHANNEL_SUPPORT
46 }) 43 })
47 44
48 this.paramsSub = this.route.params.subscribe(routeParams => { 45 this.paramsSub = this.route.params.subscribe(routeParams => {