]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Put presentation logic in the components
authorChocobozzz <florian.bigard@gmail.com>
Fri, 27 May 2016 15:52:41 +0000 (17:52 +0200)
committerChocobozzz <florian.bigard@gmail.com>
Fri, 27 May 2016 15:52:41 +0000 (17:52 +0200)
client/app/videos/video-add/video-add.component.ts
client/app/videos/video-list/video-list.component.html
client/app/videos/video-list/video-list.component.ts

index b11475ae9f1339e6fa2cd9354cfcbf66081cfeb9..eb10aedeb2bc41c11de77e1f85d66febb7daa19a 100644 (file)
@@ -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();
   }
 }
index edbbaf3aeacd735a30e64d326ef20cb89122b6b7..80b1e7b1b02606c7a118c6397a842c7ba2b254ba 100644 (file)
@@ -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>
index 23b97df32f62bebfeaf1d3b8df9572a375337383..131578681008504490f1e5f2799c4ddd9032e12a 100644 (file)
@@ -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);
   }