aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/video-add
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-03-27 21:11:37 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-03-27 21:11:37 +0200
commitd07137b90b2b2b0c1e93a6f0e7bf8719b133027c (patch)
tree0bb642609819bc1c8ff2761c848f8db3a9934d88 /client/src/app/videos/video-add
parent6f0c39e2de400685b7baf8340b9e132f2659365a (diff)
downloadPeerTube-d07137b90b2b2b0c1e93a6f0e7bf8719b133027c.tar.gz
PeerTube-d07137b90b2b2b0c1e93a6f0e7bf8719b133027c.tar.zst
PeerTube-d07137b90b2b2b0c1e93a6f0e7bf8719b133027c.zip
Client: add support for video licences
Diffstat (limited to 'client/src/app/videos/video-add')
-rw-r--r--client/src/app/videos/video-add/video-add.component.html12
-rw-r--r--client/src/app/videos/video-add/video-add.component.ts8
2 files changed, 20 insertions, 0 deletions
diff --git a/client/src/app/videos/video-add/video-add.component.html b/client/src/app/videos/video-add/video-add.component.html
index c6692b21d..97a3c846a 100644
--- a/client/src/app/videos/video-add/video-add.component.html
+++ b/client/src/app/videos/video-add/video-add.component.html
@@ -27,6 +27,18 @@
27 </div> 27 </div>
28 28
29 <div class="form-group"> 29 <div class="form-group">
30 <label for="licence">Licence</label>
31 <select class="form-control" id="licence" formControlName="licence">
32 <option></option>
33 <option *ngFor="let licence of videoLicences" [value]="licence.id">{{ licence.label }}</option>
34 </select>
35
36 <div *ngIf="formErrors.licence" class="alert alert-danger">
37 {{ formErrors.licence }}
38 </div>
39 </div>
40
41 <div class="form-group">
30 <label for="tags">Tags</label> <span class="little-information">(press enter to add the tag)</span> 42 <label for="tags">Tags</label> <span class="little-information">(press enter to add the tag)</span>
31 <input 43 <input
32 type="text" class="form-control" id="currentTag" 44 type="text" class="form-control" id="currentTag"
diff --git a/client/src/app/videos/video-add/video-add.component.ts b/client/src/app/videos/video-add/video-add.component.ts
index 5ed1d8841..8fae233d3 100644
--- a/client/src/app/videos/video-add/video-add.component.ts
+++ b/client/src/app/videos/video-add/video-add.component.ts
@@ -10,6 +10,7 @@ import {
10 FormReactive, 10 FormReactive,
11 VIDEO_NAME, 11 VIDEO_NAME,
12 VIDEO_CATEGORY, 12 VIDEO_CATEGORY,
13 VIDEO_LICENCE,
13 VIDEO_DESCRIPTION, 14 VIDEO_DESCRIPTION,
14 VIDEO_TAGS 15 VIDEO_TAGS
15} from '../../shared'; 16} from '../../shared';
@@ -25,18 +26,21 @@ export class VideoAddComponent extends FormReactive implements OnInit {
25 tags: string[] = []; 26 tags: string[] = [];
26 uploader: FileUploader; 27 uploader: FileUploader;
27 videoCategories = []; 28 videoCategories = [];
29 videoLicences = [];
28 30
29 error: string = null; 31 error: string = null;
30 form: FormGroup; 32 form: FormGroup;
31 formErrors = { 33 formErrors = {
32 name: '', 34 name: '',
33 category: '', 35 category: '',
36 licence: '',
34 description: '', 37 description: '',
35 currentTag: '' 38 currentTag: ''
36 }; 39 };
37 validationMessages = { 40 validationMessages = {
38 name: VIDEO_NAME.MESSAGES, 41 name: VIDEO_NAME.MESSAGES,
39 category: VIDEO_CATEGORY.MESSAGES, 42 category: VIDEO_CATEGORY.MESSAGES,
43 licence: VIDEO_LICENCE.MESSAGES,
40 description: VIDEO_DESCRIPTION.MESSAGES, 44 description: VIDEO_DESCRIPTION.MESSAGES,
41 currentTag: VIDEO_TAGS.MESSAGES 45 currentTag: VIDEO_TAGS.MESSAGES
42 }; 46 };
@@ -68,6 +72,7 @@ export class VideoAddComponent extends FormReactive implements OnInit {
68 this.form = this.formBuilder.group({ 72 this.form = this.formBuilder.group({
69 name: [ '', VIDEO_NAME.VALIDATORS ], 73 name: [ '', VIDEO_NAME.VALIDATORS ],
70 category: [ '', VIDEO_CATEGORY.VALIDATORS ], 74 category: [ '', VIDEO_CATEGORY.VALIDATORS ],
75 licence: [ '', VIDEO_LICENCE.VALIDATORS ],
71 description: [ '', VIDEO_DESCRIPTION.VALIDATORS ], 76 description: [ '', VIDEO_DESCRIPTION.VALIDATORS ],
72 currentTag: [ '', VIDEO_TAGS.VALIDATORS ] 77 currentTag: [ '', VIDEO_TAGS.VALIDATORS ]
73 }); 78 });
@@ -77,6 +82,7 @@ export class VideoAddComponent extends FormReactive implements OnInit {
77 82
78 ngOnInit() { 83 ngOnInit() {
79 this.videoCategories = this.videoService.videoCategories; 84 this.videoCategories = this.videoService.videoCategories;
85 this.videoLicences = this.videoService.videoLicences;
80 86
81 this.uploader = new FileUploader({ 87 this.uploader = new FileUploader({
82 authToken: this.authService.getRequestHeaderValue(), 88 authToken: this.authService.getRequestHeaderValue(),
@@ -88,10 +94,12 @@ export class VideoAddComponent extends FormReactive implements OnInit {
88 this.uploader.onBuildItemForm = (item, form) => { 94 this.uploader.onBuildItemForm = (item, form) => {
89 const name = this.form.value['name']; 95 const name = this.form.value['name'];
90 const category = this.form.value['category']; 96 const category = this.form.value['category'];
97 const licence = this.form.value['licence'];
91 const description = this.form.value['description']; 98 const description = this.form.value['description'];
92 99
93 form.append('name', name); 100 form.append('name', name);
94 form.append('category', category); 101 form.append('category', category);
102 form.append('licence', licence);
95 form.append('description', description); 103 form.append('description', description);
96 104
97 for (let i = 0; i < this.tags.length; i++) { 105 for (let i = 0; i < this.tags.length; i++) {