mirror of https://github.com/Chocobozzz/PeerTube
Put presentation logic in the components
parent
4fd8aa3270
commit
9bfe96e19f
|
@ -25,9 +25,9 @@ export class VideoAddComponent implements OnInit {
|
|||
private form: any;
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
private authService: AuthService,
|
||||
private elementRef: ElementRef,
|
||||
private authService: AuthService
|
||||
private router: Router
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
|
@ -62,8 +62,8 @@ export class VideoAddComponent implements OnInit {
|
|||
}
|
||||
|
||||
uploadFile() {
|
||||
this.form.headers = this.authService.getRequestHeader().toJSON();
|
||||
this.form.formData = jQuery(this.elementRef.nativeElement).find('form').serializeArray();
|
||||
this.form.headers = this.authService.getRequestHeader().toJSON();
|
||||
this.form.submit();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<div class="videos-miniatures">
|
||||
<my-loader [loading]="loading"></my-loader>
|
||||
|
||||
<div class="col-md-12 no-video" *ngIf="!loading && videos.length === 0">There is no video.</div>
|
||||
<div class="col-md-12 no-video" *ngIf="noVideo()">There is no video.</div>
|
||||
|
||||
<my-video-miniature *ngFor="let video of videos" [video]="video" [user]="user" (removed)="onRemoved(video)">
|
||||
</my-video-miniature>
|
||||
|
|
|
@ -80,6 +80,10 @@ export class VideoListComponent implements OnInit {
|
|||
);
|
||||
}
|
||||
|
||||
noVideo() {
|
||||
return !this.loading && this.videos.length === 0;
|
||||
}
|
||||
|
||||
onRemoved(video: Video) {
|
||||
this.videos.splice(this.videos.indexOf(video), 1);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue