]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
special display case for logged-out users to display download in watch page
authorRigel Kent <sendmemail@rigelk.eu>
Mon, 3 Aug 2020 19:06:45 +0000 (21:06 +0200)
committerRigel Kent <par@rigelk.eu>
Tue, 4 Aug 2020 14:06:40 +0000 (16:06 +0200)
client/src/app/+videos/+video-watch/video-watch.component.html
client/src/app/+videos/+video-watch/video-watch.component.ts

index fb6d0816785f5cb3ae7138409b32907af6d7208d..2588b9af573aca4cefc6f71883b6eb942b067dca 100644 (file)
                     </div>
                   </div>
 
-                  <my-video-actions-dropdown
-                    placement="bottom auto" buttonDirection="horizontal" [buttonStyled]="true" [video]="video" [videoCaptions]="videoCaptions"
-                    (videoRemoved)="onVideoRemoved()" (modalOpened)="onModalOpened()"
-                  ></my-video-actions-dropdown>
+                  <ng-container *ngIf="!isUserLoggedIn()">
+                    <button
+                      *ngIf="isVideoDownloadable()" class="action-button action-button-save"
+                      (click)="showDownloadModal()" (keydown.enter)="showDownloadModal()"
+                    >
+                      <my-global-icon iconName="download" aria-hidden="true"></my-global-icon>
+                      <span class="icon-text d-none d-sm-inline" i18n>DOWNLOAD</span>
+                    </button>
+                  
+                    <my-video-download #videoDownloadModal></my-video-download>
+                  </ng-container>
+                  <ng-container *ngIf="isUserLoggedIn()">
+                    <my-video-actions-dropdown
+                      placement="bottom auto" buttonDirection="horizontal" [buttonStyled]="true" [video]="video" [videoCaptions]="videoCaptions"
+                      (videoRemoved)="onVideoRemoved()" (modalOpened)="onModalOpened()"
+                    ></my-video-actions-dropdown>
+                  </ng-container>
                 </div>
 
                 <div class="video-info-likes-dislikes-bar-outer-container">
index 4341514cd8717daa4802fb6d2ed32d810cdb2d44..e355faf251b42a2bb035fc262bac0c9061485964 100644 (file)
@@ -28,6 +28,7 @@ import { environment } from '../../../environments/environment'
 import { VideoShareComponent } from './modal/video-share.component'
 import { VideoSupportComponent } from './modal/video-support.component'
 import { VideoWatchPlaylistComponent } from './video-watch-playlist.component'
+import { VideoDownloadComponent } from '@app/shared/shared-video-miniature'
 
 @Component({
   selector: 'my-video-watch',
@@ -41,6 +42,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
   @ViewChild('videoShareModal') videoShareModal: VideoShareComponent
   @ViewChild('videoSupportModal') videoSupportModal: VideoSupportComponent
   @ViewChild('subscribeButton') subscribeButton: SubscribeButtonComponent
+  @ViewChild('videoDownloadModal') videoDownloadModal: VideoDownloadComponent
 
   player: any
   playerElement: HTMLVideoElement
@@ -201,6 +203,14 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
     this.completeDescriptionShown = false
   }
 
+  showDownloadModal () {
+    this.videoDownloadModal.show(this.video, this.videoCaptions)
+  }
+
+  isVideoDownloadable () {
+    return this.video && this.video instanceof VideoDetails && this.video.downloadEnabled
+  }
+
   loadCompleteDescription () {
     this.descriptionLoading = true