diff options
author | Chocobozzz <me@florianbigard.com> | 2018-01-03 11:10:40 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-01-03 11:10:40 +0100 |
commit | 01de67b9a4fcdf01102ccc3cb7dc24beebf6c7ea (patch) | |
tree | 9e01809f09adbcd512a8dedf73093a123f88e02c /client/src/app/account/account-settings | |
parent | 47564bbe2eeb2baae9b7e3f9b2b8d16522bc7e04 (diff) | |
download | PeerTube-01de67b9a4fcdf01102ccc3cb7dc24beebf6c7ea.tar.gz PeerTube-01de67b9a4fcdf01102ccc3cb7dc24beebf6c7ea.tar.zst PeerTube-01de67b9a4fcdf01102ccc3cb7dc24beebf6c7ea.zip |
Add avatar max size limit
Diffstat (limited to 'client/src/app/account/account-settings')
3 files changed, 22 insertions, 5 deletions
diff --git a/client/src/app/account/account-settings/account-settings.component.html b/client/src/app/account/account-settings/account-settings.component.html index fe345207a..0d1637c40 100644 --- a/client/src/app/account/account-settings/account-settings.component.html +++ b/client/src/app/account/account-settings/account-settings.component.html | |||
@@ -9,8 +9,9 @@ | |||
9 | 9 | ||
10 | <div class="button-file"> | 10 | <div class="button-file"> |
11 | <span>Change your avatar</span> | 11 | <span>Change your avatar</span> |
12 | <input #avatarfileInput type="file" name="avatarfile" id="avatarfile" (change)="changeAvatar()" /> | 12 | <input #avatarfileInput type="file" name="avatarfile" id="avatarfile" [accept]="avatarExtensions" (change)="changeAvatar()" /> |
13 | </div> | 13 | </div> |
14 | <div class="file-max-size">(extensions: {{ avatarExtensions }}, max size: {{ maxAvatarSize | bytes }})</div> | ||
14 | 15 | ||
15 | <div class="account-title">Account settings</div> | 16 | <div class="account-title">Account settings</div> |
16 | <my-account-change-password></my-account-change-password> | 17 | <my-account-change-password></my-account-change-password> |
diff --git a/client/src/app/account/account-settings/account-settings.component.scss b/client/src/app/account/account-settings/account-settings.component.scss index accd65214..c8a27dbcd 100644 --- a/client/src/app/account/account-settings/account-settings.component.scss +++ b/client/src/app/account/account-settings/account-settings.component.scss | |||
@@ -22,11 +22,19 @@ | |||
22 | } | 22 | } |
23 | 23 | ||
24 | .button-file { | 24 | .button-file { |
25 | @include peertube-button-file(auto); | 25 | @include peertube-button-file(160px); |
26 | 26 | ||
27 | margin-top: 10px; | 27 | margin-top: 10px; |
28 | } | 28 | } |
29 | 29 | ||
30 | .file-max-size { | ||
31 | display: inline-block; | ||
32 | font-size: 13px; | ||
33 | |||
34 | position: relative; | ||
35 | top: -10px; | ||
36 | } | ||
37 | |||
30 | .account-title { | 38 | .account-title { |
31 | text-transform: uppercase; | 39 | text-transform: uppercase; |
32 | color: $orange-color; | 40 | color: $orange-color; |
diff --git a/client/src/app/account/account-settings/account-settings.component.ts b/client/src/app/account/account-settings/account-settings.component.ts index 3e03085ce..d5f5ff30f 100644 --- a/client/src/app/account/account-settings/account-settings.component.ts +++ b/client/src/app/account/account-settings/account-settings.component.ts | |||
@@ -1,9 +1,8 @@ | |||
1 | import { HttpEventType, HttpResponse } from '@angular/common/http' | ||
2 | import { Component, OnInit, ViewChild } from '@angular/core' | 1 | import { Component, OnInit, ViewChild } from '@angular/core' |
3 | import { NotificationsService } from 'angular2-notifications' | 2 | import { NotificationsService } from 'angular2-notifications' |
4 | import { VideoPrivacy } from '../../../../../shared/models/videos' | ||
5 | import { User } from '../../shared' | ||
6 | import { AuthService } from '../../core' | 3 | import { AuthService } from '../../core' |
4 | import { ServerService } from '../../core/server' | ||
5 | import { User } from '../../shared' | ||
7 | import { UserService } from '../../shared/users' | 6 | import { UserService } from '../../shared/users' |
8 | 7 | ||
9 | @Component({ | 8 | @Component({ |
@@ -19,6 +18,7 @@ export class AccountSettingsComponent implements OnInit { | |||
19 | constructor ( | 18 | constructor ( |
20 | private userService: UserService, | 19 | private userService: UserService, |
21 | private authService: AuthService, | 20 | private authService: AuthService, |
21 | private serverService: ServerService, | ||
22 | private notificationsService: NotificationsService | 22 | private notificationsService: NotificationsService |
23 | ) {} | 23 | ) {} |
24 | 24 | ||
@@ -47,4 +47,12 @@ export class AccountSettingsComponent implements OnInit { | |||
47 | err => this.notificationsService.error('Error', err.message) | 47 | err => this.notificationsService.error('Error', err.message) |
48 | ) | 48 | ) |
49 | } | 49 | } |
50 | |||
51 | get maxAvatarSize () { | ||
52 | return this.serverService.getConfig().avatar.file.size.max | ||
53 | } | ||
54 | |||
55 | get avatarExtensions () { | ||
56 | return this.serverService.getConfig().avatar.file.extensions.join(',') | ||
57 | } | ||
50 | } | 58 | } |