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/shared/shared-main | |
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/shared/shared-main')
-rw-r--r-- | client/src/app/shared/shared-main/shared-main.module.ts | 7 | ||||
-rw-r--r-- | client/src/app/shared/shared-main/video/video.service.ts | 12 |
2 files changed, 13 insertions, 6 deletions
diff --git a/client/src/app/shared/shared-main/shared-main.module.ts b/client/src/app/shared/shared-main/shared-main.module.ts index 22a207e51..a4d18d562 100644 --- a/client/src/app/shared/shared-main/shared-main.module.ts +++ b/client/src/app/shared/shared-main/shared-main.module.ts | |||
@@ -17,6 +17,7 @@ import { | |||
17 | NgbPopoverModule, | 17 | NgbPopoverModule, |
18 | NgbTooltipModule | 18 | NgbTooltipModule |
19 | } from '@ng-bootstrap/ng-bootstrap' | 19 | } from '@ng-bootstrap/ng-bootstrap' |
20 | import { NgSelectModule } from '@ng-select/ng-select' | ||
20 | import { I18n } from '@ngx-translate/i18n-polyfill' | 21 | import { I18n } from '@ngx-translate/i18n-polyfill' |
21 | import { SharedGlobalIconModule } from '../shared-icons' | 22 | import { SharedGlobalIconModule } from '../shared-icons' |
22 | import { AccountService, ActorAvatarInfoComponent, AvatarComponent } from './account' | 23 | import { AccountService, ActorAvatarInfoComponent, AvatarComponent } from './account' |
@@ -55,6 +56,8 @@ import { AUTH_INTERCEPTOR_PROVIDER } from './auth' | |||
55 | MultiSelectModule, | 56 | MultiSelectModule, |
56 | InputSwitchModule, | 57 | InputSwitchModule, |
57 | 58 | ||
59 | NgSelectModule, | ||
60 | |||
58 | SharedGlobalIconModule | 61 | SharedGlobalIconModule |
59 | ], | 62 | ], |
60 | 63 | ||
@@ -134,7 +137,9 @@ import { AUTH_INTERCEPTOR_PROVIDER } from './auth' | |||
134 | TopMenuDropdownComponent, | 137 | TopMenuDropdownComponent, |
135 | 138 | ||
136 | UserQuotaComponent, | 139 | UserQuotaComponent, |
137 | UserNotificationsComponent | 140 | UserNotificationsComponent, |
141 | |||
142 | NgSelectModule | ||
138 | ], | 143 | ], |
139 | 144 | ||
140 | providers: [ | 145 | providers: [ |
diff --git a/client/src/app/shared/shared-main/video/video.service.ts b/client/src/app/shared/shared-main/video/video.service.ts index edaefa9f2..978f775bf 100644 --- a/client/src/app/shared/shared-main/video/video.service.ts +++ b/client/src/app/shared/shared-main/video/video.service.ts | |||
@@ -339,23 +339,25 @@ export class VideoService implements VideosProvider { | |||
339 | const base = [ | 339 | const base = [ |
340 | { | 340 | { |
341 | id: VideoPrivacy.PRIVATE, | 341 | id: VideoPrivacy.PRIVATE, |
342 | label: this.i18n('Only I can see this video') | 342 | description: this.i18n('Only I can see this video') |
343 | }, | 343 | }, |
344 | { | 344 | { |
345 | id: VideoPrivacy.UNLISTED, | 345 | id: VideoPrivacy.UNLISTED, |
346 | label: this.i18n('Only people with the private link can see this video') | 346 | description: this.i18n('Only shareable via a private link') |
347 | }, | 347 | }, |
348 | { | 348 | { |
349 | id: VideoPrivacy.PUBLIC, | 349 | id: VideoPrivacy.PUBLIC, |
350 | label: this.i18n('Anyone can see this video') | 350 | description: this.i18n('Anyone can see this video') |
351 | }, | 351 | }, |
352 | { | 352 | { |
353 | id: VideoPrivacy.INTERNAL, | 353 | id: VideoPrivacy.INTERNAL, |
354 | label: this.i18n('Only users of this instance can see this video') | 354 | description: this.i18n('Only users of this instance can see this video') |
355 | } | 355 | } |
356 | ] | 356 | ] |
357 | 357 | ||
358 | return base.filter(o => !!privacies.find(p => p.id === o.id)) | 358 | return base |
359 | .filter(o => !!privacies.find(p => p.id === o.id)) // filter down to privacies that where in the input | ||
360 | .map(o => ({ ...privacies[o.id - 1], ...o })) // merge the input privacies that contain a label, and extend them with a description | ||
359 | } | 361 | } |
360 | 362 | ||
361 | nsfwPolicyToParam (nsfwPolicy: NSFWPolicyType) { | 363 | nsfwPolicyToParam (nsfwPolicy: NSFWPolicyType) { |