videoCategories: Array<{ id: number, label: string }> = [];
videoLicences: Array<{ id: number, label: string }> = [];
+ videoLanguages: Array<{ id: number, label: string }> = [];
constructor(
private authService: AuthService,
});
}
+ loadVideoLanguages() {
+ return this.http.get(VideoService.BASE_VIDEO_URL + 'languages')
+ .map(this.restExtractor.extractDataGet)
+ .subscribe(data => {
+ Object.keys(data).forEach(languageKey => {
+ this.videoLanguages.push({
+ id: parseInt(languageKey),
+ label: data[languageKey]
+ });
+ });
+ });
+ }
+
getVideo(id: string): Observable<Video> {
return this.http.get(VideoService.BASE_VIDEO_URL + id)
.map(this.restExtractor.extractDataGet)
</div>
</div>
+ <div class="form-group">
+ <label for="language">Language</label>
+ <select class="form-control" id="language" formControlName="language">
+ <option></option>
+ <option *ngFor="let language of videoLanguages" [value]="language.id">{{ language.label }}</option>
+ </select>
+
+ <div *ngIf="formErrors.language" class="alert alert-danger">
+ {{ formErrors.language }}
+ </div>
+ </div>
+
<div class="form-group">
<label for="tags">Tags</label> <span class="little-information">(press enter to add the tag)</span>
<input
VIDEO_NAME,
VIDEO_CATEGORY,
VIDEO_LICENCE,
+ VIDEO_LANGUAGE,
VIDEO_DESCRIPTION,
VIDEO_TAGS
} from '../../shared';
uploader: FileUploader;
videoCategories = [];
videoLicences = [];
+ videoLanguages = [];
error: string = null;
form: FormGroup;
name: '',
category: '',
licence: '',
+ language: '',
description: '',
currentTag: ''
};
name: VIDEO_NAME.MESSAGES,
category: VIDEO_CATEGORY.MESSAGES,
licence: VIDEO_LICENCE.MESSAGES,
+ language: VIDEO_LANGUAGE.MESSAGES,
description: VIDEO_DESCRIPTION.MESSAGES,
currentTag: VIDEO_TAGS.MESSAGES
};
nsfw: [ false ],
category: [ '', VIDEO_CATEGORY.VALIDATORS ],
licence: [ '', VIDEO_LICENCE.VALIDATORS ],
+ language: [ '', VIDEO_LANGUAGE.VALIDATORS ],
description: [ '', VIDEO_DESCRIPTION.VALIDATORS ],
currentTag: [ '', VIDEO_TAGS.VALIDATORS ]
});
ngOnInit() {
this.videoCategories = this.videoService.videoCategories;
this.videoLicences = this.videoService.videoLicences;
+ this.videoLanguages = this.videoService.videoLanguages;
this.uploader = new FileUploader({
authToken: this.authService.getRequestHeaderValue(),
const nsfw = this.form.value['nsfw'];
const category = this.form.value['category'];
const licence = this.form.value['licence'];
+ const language = this.form.value['language'];
const description = this.form.value['description'];
form.append('name', name);
form.append('category', category);
form.append('nsfw', nsfw);
form.append('licence', licence);
+
+ // Language is optional
+ if (language) {
+ form.append('language', language);
+ }
+
form.append('description', description);
for (let i = 0; i < this.tags.length; i++) {