From e309822b93d9b69f30cbe830ef3d09dfdb2c13b2 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 5 Jun 2018 15:01:45 +0200 Subject: Add form validator translations --- .../my-account-change-password.component.ts | 8 ++++-- .../my-account-profile.component.html | 32 ++++++++++++---------- .../my-account-profile.component.scss | 5 +++- .../my-account-profile.component.ts | 8 ++++-- .../my-account-video-channel-create.component.ts | 13 ++++----- .../my-account-video-channel-update.component.ts | 13 ++++----- 6 files changed, 42 insertions(+), 37 deletions(-) (limited to 'client/src/app/+my-account') 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 @@ import { Component, OnInit } from '@angular/core' import { NotificationsService } from 'angular2-notifications' -import { FormReactive, USER_PASSWORD, UserService } from '../../../shared' +import { FormReactive, UserService } from '../../../shared' import { I18n } from '@ngx-translate/i18n-polyfill' import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' +import { UserValidatorsService } from '@app/shared/forms/form-validators/user-validators.service' @Component({ selector: 'my-account-change-password', @@ -14,6 +15,7 @@ export class MyAccountChangePasswordComponent extends FormReactive implements On constructor ( protected formValidatorService: FormValidatorService, + private userValidatorsService: UserValidatorsService, private notificationsService: NotificationsService, private userService: UserService, private i18n: I18n @@ -23,8 +25,8 @@ export class MyAccountChangePasswordComponent extends FormReactive implements On ngOnInit () { this.buildForm({ - 'new-password': USER_PASSWORD, - 'new-confirmed-password': USER_PASSWORD + 'new-password': this.userValidatorsService.USER_PASSWORD, + 'new-confirmed-password': this.userValidatorsService.USER_PASSWORD }) } 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 @@
- - -
- {{ formErrors['display-name'] }} +
+ + +
+ {{ formErrors['display-name'] }} +
- - -
- {{ formErrors.description }} +
+ + +
+ {{ formErrors.description }} +
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 @@ @import '_variables'; @import '_mixins'; +.form-group:first-child { + margin-bottom: 15px; +} + input[type=text] { @include peertube-input-text(340px); display: block; - margin-bottom: 15px; } textarea { 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 @@ import { Component, Input, OnInit } from '@angular/core' import { NotificationsService } from 'angular2-notifications' -import { FormReactive, USER_DESCRIPTION, USER_DISPLAY_NAME, UserService } from '../../../shared' +import { FormReactive, UserService } from '../../../shared' import { User } from '@app/shared' import { I18n } from '@ngx-translate/i18n-polyfill' import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' import { Subject } from 'rxjs/Subject' +import { UserValidatorsService } from '@app/shared/forms/form-validators/user-validators.service' @Component({ selector: 'my-account-profile', @@ -19,6 +20,7 @@ export class MyAccountProfileComponent extends FormReactive implements OnInit { constructor ( protected formValidatorService: FormValidatorService, + private userValidatorsService: UserValidatorsService, private notificationsService: NotificationsService, private userService: UserService, private i18n: I18n @@ -28,8 +30,8 @@ export class MyAccountProfileComponent extends FormReactive implements OnInit { ngOnInit () { this.buildForm({ - 'display-name': USER_DISPLAY_NAME, - description: USER_DESCRIPTION + 'display-name': this.userValidatorsService.USER_DISPLAY_NAME, + description: this.userValidatorsService.USER_DESCRIPTION }) 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' import { NotificationsService } from 'angular2-notifications' import { MyAccountVideoChannelEdit } from './my-account-video-channel-edit' import { VideoChannelCreate } from '../../../../../shared/models/videos' -import { - VIDEO_CHANNEL_DESCRIPTION, - VIDEO_CHANNEL_DISPLAY_NAME, - VIDEO_CHANNEL_SUPPORT -} from '@app/shared/forms/form-validators/video-channel' import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' import { AuthService } from '@app/core' import { I18n } from '@ngx-translate/i18n-polyfill' import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' +import { VideoChannelValidatorsService } from '@app/shared/forms/form-validators/video-channel-validators.service' @Component({ selector: 'my-account-video-channel-create', @@ -24,6 +20,7 @@ export class MyAccountVideoChannelCreateComponent extends MyAccountVideoChannelE constructor ( protected formValidatorService: FormValidatorService, private authService: AuthService, + private videoChannelValidatorsService: VideoChannelValidatorsService, private notificationsService: NotificationsService, private router: Router, private videoChannelService: VideoChannelService, @@ -34,9 +31,9 @@ export class MyAccountVideoChannelCreateComponent extends MyAccountVideoChannelE ngOnInit () { this.buildForm({ - 'display-name': VIDEO_CHANNEL_DISPLAY_NAME, - description: VIDEO_CHANNEL_DESCRIPTION, - support: VIDEO_CHANNEL_SUPPORT + 'display-name': this.videoChannelValidatorsService.VIDEO_CHANNEL_DISPLAY_NAME, + description: this.videoChannelValidatorsService.VIDEO_CHANNEL_DESCRIPTION, + support: this.videoChannelValidatorsService.VIDEO_CHANNEL_SUPPORT }) } 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' import { NotificationsService } from 'angular2-notifications' import { MyAccountVideoChannelEdit } from './my-account-video-channel-edit' import { VideoChannelUpdate } from '../../../../../shared/models/videos' -import { - VIDEO_CHANNEL_DESCRIPTION, - VIDEO_CHANNEL_DISPLAY_NAME, - VIDEO_CHANNEL_SUPPORT -} from '@app/shared/forms/form-validators/video-channel' import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' import { Subscription } from 'rxjs' import { VideoChannel } from '@app/shared/video-channel/video-channel.model' import { AuthService } from '@app/core' import { I18n } from '@ngx-translate/i18n-polyfill' import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' +import { VideoChannelValidatorsService } from '@app/shared/forms/form-validators/video-channel-validators.service' @Component({ selector: 'my-account-video-channel-update', @@ -29,6 +25,7 @@ export class MyAccountVideoChannelUpdateComponent extends MyAccountVideoChannelE constructor ( protected formValidatorService: FormValidatorService, private authService: AuthService, + private videoChannelValidatorsService: VideoChannelValidatorsService, private notificationsService: NotificationsService, private router: Router, private route: ActivatedRoute, @@ -40,9 +37,9 @@ export class MyAccountVideoChannelUpdateComponent extends MyAccountVideoChannelE ngOnInit () { this.buildForm({ - 'display-name': VIDEO_CHANNEL_DISPLAY_NAME, - description: VIDEO_CHANNEL_DESCRIPTION, - support: VIDEO_CHANNEL_SUPPORT + 'display-name': this.videoChannelValidatorsService.VIDEO_CHANNEL_DISPLAY_NAME, + description: this.videoChannelValidatorsService.VIDEO_CHANNEL_DESCRIPTION, + support: this.videoChannelValidatorsService.VIDEO_CHANNEL_SUPPORT }) this.paramsSub = this.route.params.subscribe(routeParams => { -- cgit v1.2.3