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/+videos/+video-edit | |
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/+videos/+video-edit')
13 files changed, 93 insertions, 93 deletions
diff --git a/client/src/app/+videos/+video-edit/shared/video-caption-add-modal.component.html b/client/src/app/+videos/+video-edit/shared/video-caption-add-modal.component.html index 6a9e31b5a..6a07dafa7 100644 --- a/client/src/app/+videos/+video-edit/shared/video-caption-add-modal.component.html +++ b/client/src/app/+videos/+video-edit/shared/video-caption-add-modal.component.html | |||
@@ -8,11 +8,11 @@ | |||
8 | 8 | ||
9 | <div class="modal-body"> | 9 | <div class="modal-body"> |
10 | <label i18n for="language">Language</label> | 10 | <label i18n for="language">Language</label> |
11 | <div class="peertube-select-container"> | 11 | <div class="peertube-ng-select-container"> |
12 | <select id="language" formControlName="language" class="form-control"> | 12 | <ng-select |
13 | <option></option> | 13 | labelForId="language" [items]="videoCaptionLanguages" formControlName="language" |
14 | <option *ngFor="let language of videoCaptionLanguages" [value]="language.id">{{ language.label }}</option> | 14 | bindLabel="label" bindValue="id" |
15 | </select> | 15 | ></ng-select> |
16 | </div> | 16 | </div> |
17 | 17 | ||
18 | <div *ngIf="formErrors.language" class="form-error"> | 18 | <div *ngIf="formErrors.language" class="form-error"> |
diff --git a/client/src/app/+videos/+video-edit/shared/video-caption-add-modal.component.scss b/client/src/app/+videos/+video-edit/shared/video-caption-add-modal.component.scss index b257a16a9..0958b5f80 100644 --- a/client/src/app/+videos/+video-edit/shared/video-caption-add-modal.component.scss +++ b/client/src/app/+videos/+video-edit/shared/video-caption-add-modal.component.scss | |||
@@ -1,8 +1,9 @@ | |||
1 | @import '_variables'; | 1 | @import '_variables'; |
2 | @import '_mixins'; | 2 | @import '_mixins'; |
3 | 3 | ||
4 | .peertube-select-container { | 4 | label { |
5 | @include peertube-select-container(auto); | 5 | font-weight: $font-regular; |
6 | font-size: 100%; | ||
6 | } | 7 | } |
7 | 8 | ||
8 | .caption-file { | 9 | .caption-file { |
diff --git a/client/src/app/+videos/+video-edit/shared/video-edit.component.html b/client/src/app/+videos/+video-edit/shared/video-edit.component.html index 4d3b84626..ae3413e79 100644 --- a/client/src/app/+videos/+video-edit/shared/video-edit.component.html +++ b/client/src/app/+videos/+video-edit/shared/video-edit.component.html | |||
@@ -28,11 +28,10 @@ | |||
28 | </ng-template> | 28 | </ng-template> |
29 | </my-help> | 29 | </my-help> |
30 | 30 | ||
31 | <tag-input | 31 | <my-select-tags labelForId="label-tags" formControlName="tags"></my-select-tags> |
32 | [validators]="tagValidators" [errorMessages]="tagValidatorsMessages" | 32 | <div *ngIf="formErrors.tags" class="form-error"> |
33 | i18n-placeholder placeholder="+ Tag" i18n-secondaryPlaceholder secondaryPlaceholder="Enter a new tag" | 33 | {{ formErrors.tags }} |
34 | formControlName="tags" [maxItems]="5" [modelAsStrings]="true" | 34 | </div> |
35 | ></tag-input> | ||
36 | </div> | 35 | </div> |
37 | 36 | ||
38 | <div class="form-group"> | 37 | <div class="form-group"> |
@@ -56,22 +55,15 @@ | |||
56 | 55 | ||
57 | <div class="col-video-edit"> | 56 | <div class="col-video-edit"> |
58 | <div class="form-group"> | 57 | <div class="form-group"> |
59 | <label i18n>Channel</label> | 58 | <label i18n for="channel">Channel</label> |
60 | <div class="peertube-select-container"> | 59 | <my-select-channel labelForId="channel" [items]="userVideoChannels" formControlName="channelId"></my-select-channel> |
61 | <select formControlName="channelId" class="form-control"> | ||
62 | <option *ngFor="let channel of userVideoChannels" [value]="channel.id">{{ channel.label }}</option> | ||
63 | </select> | ||
64 | </div> | ||
65 | </div> | 60 | </div> |
66 | 61 | ||
67 | <div class="form-group"> | 62 | <div class="form-group"> |
68 | <label i18n for="category">Category</label> | 63 | <label i18n for="category">Category</label> |
69 | <div class="peertube-select-container"> | 64 | <my-select-options |
70 | <select id="category" formControlName="category" class="form-control"> | 65 | labelForId="category" [items]="videoCategories" formControlName="category" [clearable]="true" |
71 | <option></option> | 66 | ></my-select-options> |
72 | <option *ngFor="let category of videoCategories" [value]="category.id">{{ category.label }}</option> | ||
73 | </select> | ||
74 | </div> | ||
75 | 67 | ||
76 | <div *ngIf="formErrors.category" class="form-error"> | 68 | <div *ngIf="formErrors.category" class="form-error"> |
77 | {{ formErrors.category }} | 69 | {{ formErrors.category }} |
@@ -80,12 +72,9 @@ | |||
80 | 72 | ||
81 | <div class="form-group"> | 73 | <div class="form-group"> |
82 | <label i18n for="licence">Licence</label> | 74 | <label i18n for="licence">Licence</label> |
83 | <div class="peertube-select-container"> | 75 | <my-select-options |
84 | <select id="licence" formControlName="licence" class="form-control"> | 76 | labelForId="licence" [items]="videoLicences" formControlName="licence" [clearable]="true" |
85 | <option></option> | 77 | ></my-select-options> |
86 | <option *ngFor="let licence of videoLicences" [value]="licence.id">{{ licence.label }}</option> | ||
87 | </select> | ||
88 | </div> | ||
89 | 78 | ||
90 | <div *ngIf="formErrors.licence" class="form-error"> | 79 | <div *ngIf="formErrors.licence" class="form-error"> |
91 | {{ formErrors.licence }} | 80 | {{ formErrors.licence }} |
@@ -94,12 +83,10 @@ | |||
94 | 83 | ||
95 | <div class="form-group"> | 84 | <div class="form-group"> |
96 | <label i18n for="language">Language</label> | 85 | <label i18n for="language">Language</label> |
97 | <div class="peertube-select-container"> | 86 | <my-select-options |
98 | <select id="language" formControlName="language" class="form-control"> | 87 | labelForId="language" [items]="videoLanguages" formControlName="language" |
99 | <option></option> | 88 | [clearable]="true" [searchable]="true" [groupBy]="'group'" |
100 | <option *ngFor="let language of videoLanguages" [value]="language.id">{{ language.label }}</option> | 89 | ></my-select-options> |
101 | </select> | ||
102 | </div> | ||
103 | 90 | ||
104 | <div *ngIf="formErrors.language" class="form-error"> | 91 | <div *ngIf="formErrors.language" class="form-error"> |
105 | {{ formErrors.language }} | 92 | {{ formErrors.language }} |
@@ -108,13 +95,9 @@ | |||
108 | 95 | ||
109 | <div class="form-group"> | 96 | <div class="form-group"> |
110 | <label i18n for="privacy">Privacy</label> | 97 | <label i18n for="privacy">Privacy</label> |
111 | <div class="peertube-select-container"> | 98 | <my-select-options |
112 | <select id="privacy" formControlName="privacy" class="form-control"> | 99 | labelForId="privacy" [items]="videoPrivacies" formControlName="privacy" [clearable]="false" |
113 | <option></option> | 100 | ></my-select-options> |
114 | <option *ngFor="let privacy of videoPrivacies" [value]="privacy.id">{{ privacy.label }}</option> | ||
115 | <option *ngIf="schedulePublicationPossible" [value]="SPECIAL_SCHEDULED_PRIVACY">Scheduled</option> | ||
116 | </select> | ||
117 | </div> | ||
118 | 101 | ||
119 | <div *ngIf="formErrors.privacy" class="form-error"> | 102 | <div *ngIf="formErrors.privacy" class="form-error"> |
120 | {{ formErrors.privacy }} | 103 | {{ formErrors.privacy }} |
@@ -136,7 +119,7 @@ | |||
136 | 119 | ||
137 | <my-peertube-checkbox inputName="nsfw" formControlName="nsfw" helpPlacement="bottom-right"> | 120 | <my-peertube-checkbox inputName="nsfw" formControlName="nsfw" helpPlacement="bottom-right"> |
138 | <ng-template ptTemplate="label"> | 121 | <ng-template ptTemplate="label"> |
139 | <ng-container i18n>This video contains mature or explicit content</ng-container> | 122 | <ng-container i18n>Contains sensitive content</ng-container> |
140 | </ng-template> | 123 | </ng-template> |
141 | 124 | ||
142 | <ng-template ptTemplate="help"> | 125 | <ng-template ptTemplate="help"> |
@@ -146,7 +129,7 @@ | |||
146 | 129 | ||
147 | <my-peertube-checkbox *ngIf="waitTranscodingEnabled" inputName="waitTranscoding" formControlName="waitTranscoding" helpPlacement="bottom-right"> | 130 | <my-peertube-checkbox *ngIf="waitTranscodingEnabled" inputName="waitTranscoding" formControlName="waitTranscoding" helpPlacement="bottom-right"> |
148 | <ng-template ptTemplate="label"> | 131 | <ng-template ptTemplate="label"> |
149 | <ng-container i18n>Wait transcoding before publishing the video</ng-container> | 132 | <ng-container i18n>Publish after transcoding</ng-container> |
150 | </ng-template> | 133 | </ng-template> |
151 | 134 | ||
152 | <ng-template ptTemplate="help"> | 135 | <ng-template ptTemplate="help"> |
diff --git a/client/src/app/+videos/+video-edit/shared/video-edit.component.scss b/client/src/app/+videos/+video-edit/shared/video-edit.component.scss index 69b907288..9caf009c5 100644 --- a/client/src/app/+videos/+video-edit/shared/video-edit.component.scss +++ b/client/src/app/+videos/+video-edit/shared/video-edit.component.scss | |||
@@ -161,8 +161,6 @@ p-calendar { | |||
161 | } | 161 | } |
162 | } | 162 | } |
163 | 163 | ||
164 | @include ng2-tags; | ||
165 | |||
166 | // columns for the video | 164 | // columns for the video |
167 | .col-video-edit { | 165 | .col-video-edit { |
168 | @include make-col-ready(); | 166 | @include make-col-ready(); |
diff --git a/client/src/app/+videos/+video-edit/shared/video-edit.component.ts b/client/src/app/+videos/+video-edit/shared/video-edit.component.ts index 239e453ad..4cd3838de 100644 --- a/client/src/app/+videos/+video-edit/shared/video-edit.component.ts +++ b/client/src/app/+videos/+video-edit/shared/video-edit.component.ts | |||
@@ -8,6 +8,11 @@ import { VideoCaptionEdit, VideoEdit, VideoService } from '@app/shared/shared-ma | |||
8 | import { ServerConfig, VideoConstant, VideoPrivacy } from '@shared/models' | 8 | import { ServerConfig, VideoConstant, VideoPrivacy } from '@shared/models' |
9 | import { I18nPrimengCalendarService } from './i18n-primeng-calendar.service' | 9 | import { I18nPrimengCalendarService } from './i18n-primeng-calendar.service' |
10 | import { VideoCaptionAddModalComponent } from './video-caption-add-modal.component' | 10 | import { VideoCaptionAddModalComponent } from './video-caption-add-modal.component' |
11 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
12 | import { forkJoin } from 'rxjs' | ||
13 | import { InstanceService } from '@app/shared/shared-instance' | ||
14 | |||
15 | type VideoLanguages = VideoConstant<string> & { group?: string } | ||
11 | 16 | ||
12 | @Component({ | 17 | @Component({ |
13 | selector: 'my-video-edit', | 18 | selector: 'my-video-edit', |
@@ -31,7 +36,7 @@ export class VideoEditComponent implements OnInit, OnDestroy { | |||
31 | videoPrivacies: VideoConstant<VideoPrivacy>[] = [] | 36 | videoPrivacies: VideoConstant<VideoPrivacy>[] = [] |
32 | videoCategories: VideoConstant<number>[] = [] | 37 | videoCategories: VideoConstant<number>[] = [] |
33 | videoLicences: VideoConstant<number>[] = [] | 38 | videoLicences: VideoConstant<number>[] = [] |
34 | videoLanguages: VideoConstant<string>[] = [] | 39 | videoLanguages: VideoLanguages[] = [] |
35 | 40 | ||
36 | tagValidators: ValidatorFn[] | 41 | tagValidators: ValidatorFn[] |
37 | tagValidatorsMessages: { [ name: string ]: string } | 42 | tagValidatorsMessages: { [ name: string ]: string } |
@@ -56,12 +61,11 @@ export class VideoEditComponent implements OnInit, OnDestroy { | |||
56 | private videoValidatorsService: VideoValidatorsService, | 61 | private videoValidatorsService: VideoValidatorsService, |
57 | private videoService: VideoService, | 62 | private videoService: VideoService, |
58 | private serverService: ServerService, | 63 | private serverService: ServerService, |
64 | private instanceService: InstanceService, | ||
59 | private i18nPrimengCalendarService: I18nPrimengCalendarService, | 65 | private i18nPrimengCalendarService: I18nPrimengCalendarService, |
66 | private i18n: I18n, | ||
60 | private ngZone: NgZone | 67 | private ngZone: NgZone |
61 | ) { | 68 | ) { |
62 | this.tagValidators = this.videoValidatorsService.VIDEO_TAGS.VALIDATORS | ||
63 | this.tagValidatorsMessages = this.videoValidatorsService.VIDEO_TAGS.MESSAGES | ||
64 | |||
65 | this.calendarLocale = this.i18nPrimengCalendarService.getCalendarLocale() | 69 | this.calendarLocale = this.i18nPrimengCalendarService.getCalendarLocale() |
66 | this.calendarTimezone = this.i18nPrimengCalendarService.getTimezone() | 70 | this.calendarTimezone = this.i18nPrimengCalendarService.getTimezone() |
67 | this.calendarDateFormat = this.i18nPrimengCalendarService.getDateFormat() | 71 | this.calendarDateFormat = this.i18nPrimengCalendarService.getDateFormat() |
@@ -93,7 +97,7 @@ export class VideoEditComponent implements OnInit, OnDestroy { | |||
93 | licence: this.videoValidatorsService.VIDEO_LICENCE, | 97 | licence: this.videoValidatorsService.VIDEO_LICENCE, |
94 | language: this.videoValidatorsService.VIDEO_LANGUAGE, | 98 | language: this.videoValidatorsService.VIDEO_LANGUAGE, |
95 | description: this.videoValidatorsService.VIDEO_DESCRIPTION, | 99 | description: this.videoValidatorsService.VIDEO_DESCRIPTION, |
96 | tags: null, | 100 | tags: this.videoValidatorsService.VIDEO_TAGS_ARRAY, |
97 | previewfile: null, | 101 | previewfile: null, |
98 | support: this.videoValidatorsService.VIDEO_SUPPORT, | 102 | support: this.videoValidatorsService.VIDEO_SUPPORT, |
99 | schedulePublicationAt: this.videoValidatorsService.VIDEO_SCHEDULE_PUBLICATION_AT, | 103 | schedulePublicationAt: this.videoValidatorsService.VIDEO_SCHEDULE_PUBLICATION_AT, |
@@ -126,11 +130,29 @@ export class VideoEditComponent implements OnInit, OnDestroy { | |||
126 | .subscribe(res => this.videoCategories = res) | 130 | .subscribe(res => this.videoCategories = res) |
127 | this.serverService.getVideoLicences() | 131 | this.serverService.getVideoLicences() |
128 | .subscribe(res => this.videoLicences = res) | 132 | .subscribe(res => this.videoLicences = res) |
129 | this.serverService.getVideoLanguages() | 133 | forkJoin([ |
130 | .subscribe(res => this.videoLanguages = res) | 134 | this.instanceService.getAbout(), |
135 | this.serverService.getVideoLanguages() | ||
136 | ]).pipe(map(([ about, languages ]) => ({ about, languages }))) | ||
137 | .subscribe(res => { | ||
138 | this.videoLanguages = res.languages | ||
139 | .map(l => res.about.instance.languages.includes(l.id) | ||
140 | ? { ...l, group: this.i18n('Instance languages'), groupOrder: 0 } | ||
141 | : { ...l, group: this.i18n('All languages'), groupOrder: 1 }) | ||
142 | .sort((a, b) => a.groupOrder - b.groupOrder) | ||
143 | }) | ||
131 | 144 | ||
132 | this.serverService.getVideoPrivacies() | 145 | this.serverService.getVideoPrivacies() |
133 | .subscribe(privacies => this.videoPrivacies = this.videoService.explainedPrivacyLabels(privacies)) | 146 | .subscribe(privacies => { |
147 | this.videoPrivacies = this.videoService.explainedPrivacyLabels(privacies) | ||
148 | if (this.schedulePublicationPossible) { | ||
149 | this.videoPrivacies.push({ | ||
150 | id: this.SPECIAL_SCHEDULED_PRIVACY, | ||
151 | label: this.i18n('Scheduled'), | ||
152 | description: this.i18n('Hide the video until a specific date') | ||
153 | }) | ||
154 | } | ||
155 | }) | ||
134 | 156 | ||
135 | this.serverConfig = this.serverService.getTmpConfig() | 157 | this.serverConfig = this.serverService.getTmpConfig() |
136 | this.serverService.getConfig() | 158 | this.serverService.getConfig() |
diff --git a/client/src/app/+videos/+video-edit/shared/video-edit.module.ts b/client/src/app/+videos/+video-edit/shared/video-edit.module.ts index d1bbbafe9..593114181 100644 --- a/client/src/app/+videos/+video-edit/shared/video-edit.module.ts +++ b/client/src/app/+videos/+video-edit/shared/video-edit.module.ts | |||
@@ -1,4 +1,3 @@ | |||
1 | import { TagInputModule } from 'ngx-chips' | ||
2 | import { CalendarModule } from 'primeng/calendar' | 1 | import { CalendarModule } from 'primeng/calendar' |
3 | import { NgModule } from '@angular/core' | 2 | import { NgModule } from '@angular/core' |
4 | import { SharedFormModule } from '@app/shared/shared-forms' | 3 | import { SharedFormModule } from '@app/shared/shared-forms' |
@@ -10,7 +9,6 @@ import { VideoEditComponent } from './video-edit.component' | |||
10 | 9 | ||
11 | @NgModule({ | 10 | @NgModule({ |
12 | imports: [ | 11 | imports: [ |
13 | TagInputModule, | ||
14 | CalendarModule, | 12 | CalendarModule, |
15 | 13 | ||
16 | SharedMainModule, | 14 | SharedMainModule, |
@@ -24,7 +22,6 @@ import { VideoEditComponent } from './video-edit.component' | |||
24 | ], | 22 | ], |
25 | 23 | ||
26 | exports: [ | 24 | exports: [ |
27 | TagInputModule, | ||
28 | CalendarModule, | 25 | CalendarModule, |
29 | 26 | ||
30 | SharedMainModule, | 27 | SharedMainModule, |
diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-import-torrent.component.html b/client/src/app/+videos/+video-edit/video-add-components/video-import-torrent.component.html index 5678f548f..8db37a293 100644 --- a/client/src/app/+videos/+video-edit/video-add-components/video-import-torrent.component.html +++ b/client/src/app/+videos/+video-edit/video-add-components/video-import-torrent.component.html | |||
@@ -25,20 +25,16 @@ | |||
25 | 25 | ||
26 | <div class="form-group"> | 26 | <div class="form-group"> |
27 | <label i18n for="first-step-channel">Channel</label> | 27 | <label i18n for="first-step-channel">Channel</label> |
28 | <div class="peertube-select-container"> | 28 | <my-select-channel |
29 | <select id="first-step-channel" [(ngModel)]="firstStepChannelId" class="form-control"> | 29 | labelForId="first-step-channel" [items]="userVideoChannels" [(ngModel)]="firstStepChannelId" |
30 | <option *ngFor="let channel of userVideoChannels" [value]="channel.id">{{ channel.label }}</option> | 30 | ></my-select-channel> |
31 | </select> | ||
32 | </div> | ||
33 | </div> | 31 | </div> |
34 | 32 | ||
35 | <div class="form-group"> | 33 | <div class="form-group"> |
36 | <label i18n for="first-step-privacy">Privacy</label> | 34 | <label i18n for="first-step-privacy">Privacy</label> |
37 | <div class="peertube-select-container"> | 35 | <my-select-options |
38 | <select id="first-step-privacy" [(ngModel)]="firstStepPrivacyId" class="form-control"> | 36 | labelForId="first-step-privacy" [items]="videoPrivacies" [(ngModel)]="firstStepPrivacyId" |
39 | <option *ngFor="let privacy of videoPrivacies" [value]="privacy.id">{{ privacy.label }}</option> | 37 | ></my-select-options> |
40 | </select> | ||
41 | </div> | ||
42 | </div> | 38 | </div> |
43 | 39 | ||
44 | <input | 40 | <input |
diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-import-url.component.html b/client/src/app/+videos/+video-edit/video-add-components/video-import-url.component.html index 2e434271e..9b5cc3361 100644 --- a/client/src/app/+videos/+video-edit/video-add-components/video-import-url.component.html +++ b/client/src/app/+videos/+video-edit/video-add-components/video-import-url.component.html | |||
@@ -20,20 +20,16 @@ | |||
20 | 20 | ||
21 | <div class="form-group"> | 21 | <div class="form-group"> |
22 | <label i18n for="first-step-channel">Channel</label> | 22 | <label i18n for="first-step-channel">Channel</label> |
23 | <div class="peertube-select-container"> | 23 | <my-select-channel |
24 | <select id="first-step-channel" [(ngModel)]="firstStepChannelId" class="form-control"> | 24 | labelForId="first-step-channel" [items]="userVideoChannels" [(ngModel)]="firstStepChannelId" |
25 | <option *ngFor="let channel of userVideoChannels" [value]="channel.id">{{ channel.label }}</option> | 25 | ></my-select-channel> |
26 | </select> | ||
27 | </div> | ||
28 | </div> | 26 | </div> |
29 | 27 | ||
30 | <div class="form-group"> | 28 | <div class="form-group"> |
31 | <label i18n for="first-step-privacy">Privacy</label> | 29 | <label i18n for="first-step-privacy">Privacy</label> |
32 | <div class="peertube-select-container"> | 30 | <my-select-options |
33 | <select id="first-step-privacy" [(ngModel)]="firstStepPrivacyId" class="form-control"> | 31 | labelForId="first-step-privacy" [items]="videoPrivacies" [(ngModel)]="firstStepPrivacyId" |
34 | <option *ngFor="let privacy of videoPrivacies" [value]="privacy.id">{{ privacy.label }}</option> | 32 | ></my-select-options> |
35 | </select> | ||
36 | </div> | ||
37 | </div> | 33 | </div> |
38 | 34 | ||
39 | <input | 35 | <input |
diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-send.scss b/client/src/app/+videos/+video-edit/video-add-components/video-send.scss index cdb7c8280..17c5f63e9 100644 --- a/client/src/app/+videos/+video-edit/video-add-components/video-send.scss +++ b/client/src/app/+videos/+video-edit/video-add-components/video-send.scss | |||
@@ -26,6 +26,13 @@ $width-size: 190px; | |||
26 | .peertube-select-container { | 26 | .peertube-select-container { |
27 | @include peertube-select-container($width-size); | 27 | @include peertube-select-container($width-size); |
28 | } | 28 | } |
29 | my-select-options ::ng-deep ng-select, | ||
30 | my-select-channel ::ng-deep ng-select { | ||
31 | width: $width-size; | ||
32 | @media screen and (max-width: $width-size) { | ||
33 | width: 100%; | ||
34 | } | ||
35 | } | ||
29 | 36 | ||
30 | input[type=text] { | 37 | input[type=text] { |
31 | @include peertube-input-text($width-size); | 38 | @include peertube-input-text($width-size); |
diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-send.ts b/client/src/app/+videos/+video-edit/video-add-components/video-send.ts index 2e658dfae..86f2b376f 100644 --- a/client/src/app/+videos/+video-edit/video-add-components/video-send.ts +++ b/client/src/app/+videos/+video-edit/video-add-components/video-send.ts | |||
@@ -10,7 +10,7 @@ import { ServerConfig, VideoConstant, VideoPrivacy } from '@shared/models' | |||
10 | @Directive() | 10 | @Directive() |
11 | // tslint:disable-next-line: directive-class-suffix | 11 | // tslint:disable-next-line: directive-class-suffix |
12 | export abstract class VideoSend extends FormReactive implements OnInit { | 12 | export abstract class VideoSend extends FormReactive implements OnInit { |
13 | userVideoChannels: { id: number, label: string, support: string }[] = [] | 13 | userVideoChannels: { id: number, label: string, support: string, avatarPath?: string }[] = [] |
14 | videoPrivacies: VideoConstant<VideoPrivacy>[] = [] | 14 | videoPrivacies: VideoConstant<VideoPrivacy>[] = [] |
15 | videoCaptions: VideoCaptionEdit[] = [] | 15 | videoCaptions: VideoCaptionEdit[] = [] |
16 | 16 | ||
@@ -44,7 +44,7 @@ export abstract class VideoSend extends FormReactive implements OnInit { | |||
44 | this.serverService.getVideoPrivacies() | 44 | this.serverService.getVideoPrivacies() |
45 | .subscribe( | 45 | .subscribe( |
46 | privacies => { | 46 | privacies => { |
47 | this.videoPrivacies = privacies | 47 | this.videoPrivacies = this.videoService.explainedPrivacyLabels(privacies) |
48 | 48 | ||
49 | this.firstStepPrivacyId = this.DEFAULT_VIDEO_PRIVACY | 49 | this.firstStepPrivacyId = this.DEFAULT_VIDEO_PRIVACY |
50 | }) | 50 | }) |
diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.html b/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.html index 95b6628f6..ed697c25b 100644 --- a/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.html +++ b/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.html | |||
@@ -9,21 +9,16 @@ | |||
9 | 9 | ||
10 | <div class="form-group form-group-channel"> | 10 | <div class="form-group form-group-channel"> |
11 | <label i18n for="first-step-channel">Channel</label> | 11 | <label i18n for="first-step-channel">Channel</label> |
12 | <div class="peertube-select-container"> | 12 | <my-select-channel |
13 | <select id="first-step-channel" [(ngModel)]="firstStepChannelId" class="form-control"> | 13 | labelForId="first-step-channel" [items]="userVideoChannels" [(ngModel)]="firstStepChannelId" |
14 | <option *ngFor="let channel of userVideoChannels" [value]="channel.id">{{ channel.label }}</option> | 14 | ></my-select-channel> |
15 | </select> | ||
16 | </div> | ||
17 | </div> | 15 | </div> |
18 | 16 | ||
19 | <div class="form-group"> | 17 | <div class="form-group"> |
20 | <label i18n for="first-step-privacy">Privacy</label> | 18 | <label i18n for="first-step-privacy">Privacy</label> |
21 | <div class="peertube-select-container"> | 19 | <my-select-options |
22 | <select id="first-step-privacy" [(ngModel)]="firstStepPrivacyId" class="form-control"> | 20 | labelForId="first-step-privacy" [items]="videoPrivacies" [(ngModel)]="firstStepPrivacyId" |
23 | <option *ngFor="let privacy of videoPrivacies" [value]="privacy.id">{{ privacy.label }}</option> | 21 | ></my-select-options> |
24 | <option i18n [value]="SPECIAL_SCHEDULED_PRIVACY">Scheduled</option> | ||
25 | </select> | ||
26 | </div> | ||
27 | </div> | 22 | </div> |
28 | 23 | ||
29 | <ng-container *ngIf="isUploadingAudioFile"> | 24 | <ng-container *ngIf="isUploadingAudioFile"> |
diff --git a/client/src/app/+videos/+video-edit/video-update.component.ts b/client/src/app/+videos/+video-edit/video-update.component.ts index 581199d65..de4f65df3 100644 --- a/client/src/app/+videos/+video-edit/video-update.component.ts +++ b/client/src/app/+videos/+video-edit/video-update.component.ts | |||
@@ -17,7 +17,7 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { | |||
17 | video: VideoEdit | 17 | video: VideoEdit |
18 | 18 | ||
19 | isUpdatingVideo = false | 19 | isUpdatingVideo = false |
20 | userVideoChannels: { id: number, label: string, support: string }[] = [] | 20 | userVideoChannels: { id: number, label: string, support: string, avatar?: string }[] = [] |
21 | schedulePublicationPossible = false | 21 | schedulePublicationPossible = false |
22 | videoCaptions: VideoCaptionEdit[] = [] | 22 | videoCaptions: VideoCaptionEdit[] = [] |
23 | waitTranscodingEnabled = true | 23 | waitTranscodingEnabled = true |
diff --git a/client/src/app/+videos/+video-edit/video-update.resolver.ts b/client/src/app/+videos/+video-edit/video-update.resolver.ts index 30bcf4d74..a391913d8 100644 --- a/client/src/app/+videos/+video-edit/video-update.resolver.ts +++ b/client/src/app/+videos/+video-edit/video-update.resolver.ts | |||
@@ -28,7 +28,12 @@ export class VideoUpdateResolver implements Resolve<any> { | |||
28 | .listAccountVideoChannels(video.account) | 28 | .listAccountVideoChannels(video.account) |
29 | .pipe( | 29 | .pipe( |
30 | map(result => result.data), | 30 | map(result => result.data), |
31 | map(videoChannels => videoChannels.map(c => ({ id: c.id, label: c.displayName, support: c.support }))) | 31 | map(videoChannels => videoChannels.map(c => ({ |
32 | id: c.id, | ||
33 | label: c.displayName, | ||
34 | support: c.support, | ||
35 | avatarPath: c.avatar?.path | ||
36 | }))) | ||
32 | ), | 37 | ), |
33 | 38 | ||
34 | this.videoCaptionService | 39 | this.videoCaptionService |