diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2020-08-05 00:50:07 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-08-11 09:03:39 +0200 |
commit | 02c01341f4dae30ec6b81fcb644952393d73c4a8 (patch) | |
tree | aca3f2b118bb123457fd38724be68fe877504c75 /client/src/app/helpers | |
parent | 766d13b4470de02d3d7bec94188260b89a356399 (diff) | |
download | PeerTube-02c01341f4dae30ec6b81fcb644952393d73c4a8.tar.gz PeerTube-02c01341f4dae30ec6b81fcb644952393d73c4a8.tar.zst PeerTube-02c01341f4dae30ec6b81fcb644952393d73c4a8.zip |
add ng-select for templatable select options
- create select-tags component to replace ngx-chips
- create select-options to factorize option selection in forms
- create select-channel to simplify channel selection
- refactor tags validation
Diffstat (limited to 'client/src/app/helpers')
-rw-r--r-- | client/src/app/helpers/utils.ts | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/client/src/app/helpers/utils.ts b/client/src/app/helpers/utils.ts index 825b6ca96..aa37fdd46 100644 --- a/client/src/app/helpers/utils.ts +++ b/client/src/app/helpers/utils.ts | |||
@@ -16,7 +16,10 @@ function getParameterByName (name: string, url: string) { | |||
16 | return decodeURIComponent(results[2].replace(/\+/g, ' ')) | 16 | return decodeURIComponent(results[2].replace(/\+/g, ' ')) |
17 | } | 17 | } |
18 | 18 | ||
19 | function populateAsyncUserVideoChannels (authService: AuthService, channel: { id: number, label: string, support?: string }[]) { | 19 | function populateAsyncUserVideoChannels ( |
20 | authService: AuthService, | ||
21 | channel: { id: number, label: string, support?: string, avatarPath?: string, recent?: boolean }[] | ||
22 | ) { | ||
20 | return new Promise(res => { | 23 | return new Promise(res => { |
21 | authService.userInformationLoaded | 24 | authService.userInformationLoaded |
22 | .subscribe( | 25 | .subscribe( |
@@ -27,7 +30,12 @@ function populateAsyncUserVideoChannels (authService: AuthService, channel: { id | |||
27 | const videoChannels = user.videoChannels | 30 | const videoChannels = user.videoChannels |
28 | if (Array.isArray(videoChannels) === false) return | 31 | if (Array.isArray(videoChannels) === false) return |
29 | 32 | ||
30 | videoChannels.forEach(c => channel.push({ id: c.id, label: c.displayName, support: c.support })) | 33 | videoChannels.forEach(c => channel.push({ |
34 | id: c.id, | ||
35 | label: c.displayName, | ||
36 | support: c.support, | ||
37 | avatarPath: c.avatar?.path | ||
38 | })) | ||
31 | 39 | ||
32 | return res() | 40 | return res() |
33 | } | 41 | } |