From 62e62f118d5da57acd3494fece2e8ed357564ffe Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 9 May 2018 09:26:41 +0200 Subject: Load my-account module lazily --- .../my-account-change-password/index.ts | 1 - .../my-account-change-password.component.html | 20 ------- .../my-account-change-password.component.scss | 19 ------ .../my-account-change-password.component.ts | 62 ------------------- .../my-account-profile/index.ts | 1 - .../my-account-profile.component.html | 24 -------- .../my-account-profile.component.scss | 23 ------- .../my-account-profile.component.ts | 65 -------------------- .../my-account-settings.component.html | 32 ---------- .../my-account-settings.component.scss | 67 --------------------- .../my-account-settings.component.ts | 70 ---------------------- .../my-account-video-settings/index.ts | 1 - .../my-account-video-settings.component.html | 25 -------- .../my-account-video-settings.component.scss | 20 ------- .../my-account-video-settings.component.ts | 60 ------------------- 15 files changed, 490 deletions(-) delete mode 100644 client/src/app/my-account/my-account-settings/my-account-change-password/index.ts delete mode 100644 client/src/app/my-account/my-account-settings/my-account-change-password/my-account-change-password.component.html delete mode 100644 client/src/app/my-account/my-account-settings/my-account-change-password/my-account-change-password.component.scss delete mode 100644 client/src/app/my-account/my-account-settings/my-account-change-password/my-account-change-password.component.ts delete mode 100644 client/src/app/my-account/my-account-settings/my-account-profile/index.ts delete mode 100644 client/src/app/my-account/my-account-settings/my-account-profile/my-account-profile.component.html delete mode 100644 client/src/app/my-account/my-account-settings/my-account-profile/my-account-profile.component.scss delete mode 100644 client/src/app/my-account/my-account-settings/my-account-profile/my-account-profile.component.ts delete mode 100644 client/src/app/my-account/my-account-settings/my-account-settings.component.html delete mode 100644 client/src/app/my-account/my-account-settings/my-account-settings.component.scss delete mode 100644 client/src/app/my-account/my-account-settings/my-account-settings.component.ts delete mode 100644 client/src/app/my-account/my-account-settings/my-account-video-settings/index.ts delete mode 100644 client/src/app/my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.html delete mode 100644 client/src/app/my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.scss delete mode 100644 client/src/app/my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.ts (limited to 'client/src/app/my-account/my-account-settings') diff --git a/client/src/app/my-account/my-account-settings/my-account-change-password/index.ts b/client/src/app/my-account/my-account-settings/my-account-change-password/index.ts deleted file mode 100644 index 644047c5f..000000000 --- a/client/src/app/my-account/my-account-settings/my-account-change-password/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './my-account-change-password.component' diff --git a/client/src/app/my-account/my-account-settings/my-account-change-password/my-account-change-password.component.html b/client/src/app/my-account/my-account-settings/my-account-change-password/my-account-change-password.component.html deleted file mode 100644 index b0e3cada4..000000000 --- a/client/src/app/my-account/my-account-settings/my-account-change-password/my-account-change-password.component.html +++ /dev/null @@ -1,20 +0,0 @@ -
{{ error }}
- -
- - - -
- {{ formErrors['new-password'] }} -
- - - - -
diff --git a/client/src/app/my-account/my-account-settings/my-account-change-password/my-account-change-password.component.scss b/client/src/app/my-account/my-account-settings/my-account-change-password/my-account-change-password.component.scss deleted file mode 100644 index f8279ffd3..000000000 --- a/client/src/app/my-account/my-account-settings/my-account-change-password/my-account-change-password.component.scss +++ /dev/null @@ -1,19 +0,0 @@ -@import '_variables'; -@import '_mixins'; - -input[type=password] { - @include peertube-input-text(340px); - display: block; - - &#new-confirmed-password { - margin-top: 15px; - } -} - -input[type=submit] { - @include peertube-button; - @include orange-button; - - margin-top: 15px; -} - 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 deleted file mode 100644 index 80af668f9..000000000 --- a/client/src/app/my-account/my-account-settings/my-account-change-password/my-account-change-password.component.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { Component, OnInit } from '@angular/core' -import { FormBuilder, FormGroup } from '@angular/forms' -import { NotificationsService } from 'angular2-notifications' -import { FormReactive, USER_PASSWORD, UserService } from '../../../shared' - -@Component({ - selector: 'my-account-change-password', - templateUrl: './my-account-change-password.component.html', - styleUrls: [ './my-account-change-password.component.scss' ] -}) -export class MyAccountChangePasswordComponent extends FormReactive implements OnInit { - error: string = null - - form: FormGroup - formErrors = { - 'new-password': '', - 'new-confirmed-password': '' - } - validationMessages = { - 'new-password': USER_PASSWORD.MESSAGES, - 'new-confirmed-password': USER_PASSWORD.MESSAGES - } - - constructor ( - private formBuilder: FormBuilder, - private notificationsService: NotificationsService, - private userService: UserService - ) { - super() - } - - buildForm () { - this.form = this.formBuilder.group({ - 'new-password': [ '', USER_PASSWORD.VALIDATORS ], - 'new-confirmed-password': [ '', USER_PASSWORD.VALIDATORS ] - }) - - this.form.valueChanges.subscribe(data => this.onValueChanged(data)) - } - - ngOnInit () { - this.buildForm() - } - - changePassword () { - const newPassword = this.form.value['new-password'] - const newConfirmedPassword = this.form.value['new-confirmed-password'] - - this.error = null - - if (newPassword !== newConfirmedPassword) { - this.error = 'The new password and the confirmed password do not correspond.' - return - } - - this.userService.changePassword(newPassword).subscribe( - () => this.notificationsService.success('Success', 'Password updated.'), - - err => this.error = err.message - ) - } -} diff --git a/client/src/app/my-account/my-account-settings/my-account-profile/index.ts b/client/src/app/my-account/my-account-settings/my-account-profile/index.ts deleted file mode 100644 index 3cc049f8f..000000000 --- a/client/src/app/my-account/my-account-settings/my-account-profile/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './my-account-profile.component' 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 deleted file mode 100644 index 306f3a12c..000000000 --- a/client/src/app/my-account/my-account-settings/my-account-profile/my-account-profile.component.html +++ /dev/null @@ -1,24 +0,0 @@ -
{{ error }}
- -
- - - -
- {{ formErrors['display-name'] }} -
- - - -
- {{ 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 deleted file mode 100644 index fc2b92c89..000000000 --- a/client/src/app/my-account/my-account-settings/my-account-profile/my-account-profile.component.scss +++ /dev/null @@ -1,23 +0,0 @@ -@import '_variables'; -@import '_mixins'; - -input[type=text] { - @include peertube-input-text(340px); - - display: block; - margin-bottom: 15px; -} - -textarea { - @include peertube-textarea(500px, 150px); - - display: block; -} - -input[type=submit] { - @include peertube-button; - @include orange-button; - - margin-top: 15px; -} - 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 deleted file mode 100644 index 2b7ba353c..000000000 --- a/client/src/app/my-account/my-account-settings/my-account-profile/my-account-profile.component.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { Component, Input, OnInit } from '@angular/core' -import { FormBuilder, FormGroup } from '@angular/forms' -import { NotificationsService } from 'angular2-notifications' -import { FormReactive, USER_DESCRIPTION, USER_DISPLAY_NAME, UserService } from '../../../shared' -import { User } from '@app/shared' - -@Component({ - selector: 'my-account-profile', - templateUrl: './my-account-profile.component.html', - styleUrls: [ './my-account-profile.component.scss' ] -}) -export class MyAccountProfileComponent extends FormReactive implements OnInit { - @Input() user: User = null - - error: string = null - - form: FormGroup - formErrors = { - 'display-name': '', - 'description': '' - } - validationMessages = { - 'display-name': USER_DISPLAY_NAME.MESSAGES, - 'description': USER_DESCRIPTION.MESSAGES - } - - constructor ( - private formBuilder: FormBuilder, - private notificationsService: NotificationsService, - private userService: UserService - ) { - super() - } - - buildForm () { - this.form = this.formBuilder.group({ - 'display-name': [ this.user.account.displayName, USER_DISPLAY_NAME.VALIDATORS ], - 'description': [ this.user.account.description, USER_DESCRIPTION.VALIDATORS ] - }) - - this.form.valueChanges.subscribe(data => this.onValueChanged(data)) - } - - ngOnInit () { - this.buildForm() - } - - updateMyProfile () { - const displayName = this.form.value['display-name'] - const description = this.form.value['description'] - - this.error = null - - this.userService.updateMyProfile({ displayName, description }).subscribe( - () => { - this.user.account.displayName = displayName - this.user.account.description = description - - this.notificationsService.success('Success', 'Profile updated.') - }, - - err => this.error = err.message - ) - } -} diff --git a/client/src/app/my-account/my-account-settings/my-account-settings.component.html b/client/src/app/my-account/my-account-settings/my-account-settings.component.html deleted file mode 100644 index 0fcc7782e..000000000 --- a/client/src/app/my-account/my-account-settings/my-account-settings.component.html +++ /dev/null @@ -1,32 +0,0 @@ -
- Avatar - - -
- -
- Change your avatar - -
-
(extensions: {{ avatarExtensions }}, max size: {{ maxAvatarSize | bytes }})
- -
- Video quota: {{ userVideoQuotaUsed | bytes: 0 }} / {{ userVideoQuota }} -
- - - - - - -
Password
- - -
Video settings
- diff --git a/client/src/app/my-account/my-account-settings/my-account-settings.component.scss b/client/src/app/my-account/my-account-settings/my-account-settings.component.scss deleted file mode 100644 index ec0d40b93..000000000 --- a/client/src/app/my-account/my-account-settings/my-account-settings.component.scss +++ /dev/null @@ -1,67 +0,0 @@ -@import '_variables'; -@import '_mixins'; - -.user { - display: flex; - - img { - @include avatar(50px); - - margin-right: 15px; - } - - .user-info { - .user-info-names { - display: flex; - align-items: center; - - .user-info-display-name { - font-size: 20px; - font-weight: $font-bold; - } - - .user-info-username { - margin-left: 7px; - position: relative; - top: 2px; - font-size: 14px; - color: #777272; - } - } - - .user-info-followers { - font-size: 15px; - } - } -} - -.button-file { - @include peertube-button-file(160px); - - margin-top: 10px; - margin-bottom: 5px; -} - -.file-max-size { - display: inline-block; - font-size: 13px; - - position: relative; - top: -10px; -} - -.user-quota { - font-size: 15px; - margin-top: 20px; - - .user-quota-label { - font-weight: $font-semibold; - } -} - -.account-title { - @include in-content-small-title; - - margin-top: 55px; - margin-bottom: 30px; -} diff --git a/client/src/app/my-account/my-account-settings/my-account-settings.component.ts b/client/src/app/my-account/my-account-settings/my-account-settings.component.ts deleted file mode 100644 index 06d1138e7..000000000 --- a/client/src/app/my-account/my-account-settings/my-account-settings.component.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { Component, OnInit, ViewChild } from '@angular/core' -import { NotificationsService } from 'angular2-notifications' -import { BytesPipe } from 'ngx-pipes' -import { AuthService } from '../../core' -import { ServerService } from '../../core/server' -import { User } from '../../shared' -import { UserService } from '../../shared/users' - -@Component({ - selector: 'my-account-settings', - templateUrl: './my-account-settings.component.html', - styleUrls: [ './my-account-settings.component.scss' ] -}) -export class MyAccountSettingsComponent implements OnInit { - @ViewChild('avatarfileInput') avatarfileInput - - user: User = null - userVideoQuota = '0' - userVideoQuotaUsed = 0 - - constructor ( - private userService: UserService, - private authService: AuthService, - private serverService: ServerService, - private notificationsService: NotificationsService - ) {} - - ngOnInit () { - this.user = this.authService.getUser() - - this.authService.userInformationLoaded.subscribe( - () => { - if (this.user.videoQuota !== -1) { - this.userVideoQuota = new BytesPipe().transform(this.user.videoQuota, 0).toString() - } else { - this.userVideoQuota = 'Unlimited' - } - } - ) - - this.userService.getMyVideoQuotaUsed() - .subscribe(data => this.userVideoQuotaUsed = data.videoQuotaUsed) - } - - changeAvatar () { - const avatarfile = this.avatarfileInput.nativeElement.files[ 0 ] - - const formData = new FormData() - formData.append('avatarfile', avatarfile) - - this.userService.changeAvatar(formData) - .subscribe( - data => { - this.notificationsService.success('Success', 'Avatar changed.') - - this.user.account.avatar = data.avatar - }, - - err => this.notificationsService.error('Error', err.message) - ) - } - - get maxAvatarSize () { - return this.serverService.getConfig().avatar.file.size.max - } - - get avatarExtensions () { - return this.serverService.getConfig().avatar.file.extensions.join(',') - } -} diff --git a/client/src/app/my-account/my-account-settings/my-account-video-settings/index.ts b/client/src/app/my-account/my-account-settings/my-account-video-settings/index.ts deleted file mode 100644 index 1253bd369..000000000 --- a/client/src/app/my-account/my-account-settings/my-account-video-settings/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './my-account-video-settings.component' diff --git a/client/src/app/my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.html b/client/src/app/my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.html deleted file mode 100644 index 0e8598e9e..000000000 --- a/client/src/app/my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.html +++ /dev/null @@ -1,25 +0,0 @@ -
-
- - - -
- -
-
- -
- - - -
- - -
diff --git a/client/src/app/my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.scss b/client/src/app/my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.scss deleted file mode 100644 index ed59e4689..000000000 --- a/client/src/app/my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.scss +++ /dev/null @@ -1,20 +0,0 @@ -@import '_variables'; -@import '_mixins'; - -input[type=checkbox] { - @include peertube-checkbox(1px); -} - -input[type=submit] { - @include peertube-button; - @include orange-button; - - display: block; - margin-top: 15px; -} - -.peertube-select-container { - @include peertube-select-container(340px); - - margin-bottom: 30px; -} \ No newline at end of file diff --git a/client/src/app/my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.ts b/client/src/app/my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.ts deleted file mode 100644 index acc70c14d..000000000 --- a/client/src/app/my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.ts +++ /dev/null @@ -1,60 +0,0 @@ -import { Component, Input, OnInit } from '@angular/core' -import { FormBuilder, FormGroup } from '@angular/forms' -import { NotificationsService } from 'angular2-notifications' -import { UserUpdateMe } from '../../../../../../shared' -import { AuthService } from '../../../core' -import { FormReactive, User, UserService } from '../../../shared' - -@Component({ - selector: 'my-account-video-settings', - templateUrl: './my-account-video-settings.component.html', - styleUrls: [ './my-account-video-settings.component.scss' ] -}) -export class MyAccountVideoSettingsComponent extends FormReactive implements OnInit { - @Input() user: User = null - - form: FormGroup - formErrors = {} - validationMessages = {} - - constructor ( - private authService: AuthService, - private formBuilder: FormBuilder, - private notificationsService: NotificationsService, - private userService: UserService - ) { - super() - } - - buildForm () { - this.form = this.formBuilder.group({ - nsfwPolicy: [ this.user.nsfwPolicy ], - autoPlayVideo: [ this.user.autoPlayVideo ] - }) - - this.form.valueChanges.subscribe(data => this.onValueChanged(data)) - } - - ngOnInit () { - this.buildForm() - } - - updateDetails () { - const nsfwPolicy = this.form.value['nsfwPolicy'] - const autoPlayVideo = this.form.value['autoPlayVideo'] - const details: UserUpdateMe = { - nsfwPolicy, - autoPlayVideo - } - - this.userService.updateMyProfile(details).subscribe( - () => { - this.notificationsService.success('Success', 'Information updated.') - - this.authService.refreshUserInformation() - }, - - err => this.notificationsService.error('Error', err.message) - ) - } -} -- cgit v1.2.3