aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2020-08-03 21:06:45 +0200
committerRigel Kent <par@rigelk.eu>2020-08-04 16:06:40 +0200
commit6863f814b06e4af92fd19bef23e6bd4b259988fa (patch)
treee4d1dcbb5c883389435fada4cb5bcd4effae6703
parent9a42363291c9f524d9603a940f929929599271c5 (diff)
downloadPeerTube-6863f814b06e4af92fd19bef23e6bd4b259988fa.tar.gz
PeerTube-6863f814b06e4af92fd19bef23e6bd4b259988fa.tar.zst
PeerTube-6863f814b06e4af92fd19bef23e6bd4b259988fa.zip
special display case for logged-out users to display download in watch page
-rw-r--r--client/src/app/+videos/+video-watch/video-watch.component.html21
-rw-r--r--client/src/app/+videos/+video-watch/video-watch.component.ts10
2 files changed, 27 insertions, 4 deletions
diff --git a/client/src/app/+videos/+video-watch/video-watch.component.html b/client/src/app/+videos/+video-watch/video-watch.component.html
index fb6d08167..2588b9af5 100644
--- a/client/src/app/+videos/+video-watch/video-watch.component.html
+++ b/client/src/app/+videos/+video-watch/video-watch.component.html
@@ -108,10 +108,23 @@
108 </div> 108 </div>
109 </div> 109 </div>
110 110
111 <my-video-actions-dropdown 111 <ng-container *ngIf="!isUserLoggedIn()">
112 placement="bottom auto" buttonDirection="horizontal" [buttonStyled]="true" [video]="video" [videoCaptions]="videoCaptions" 112 <button
113 (videoRemoved)="onVideoRemoved()" (modalOpened)="onModalOpened()" 113 *ngIf="isVideoDownloadable()" class="action-button action-button-save"
114 ></my-video-actions-dropdown> 114 (click)="showDownloadModal()" (keydown.enter)="showDownloadModal()"
115 >
116 <my-global-icon iconName="download" aria-hidden="true"></my-global-icon>
117 <span class="icon-text d-none d-sm-inline" i18n>DOWNLOAD</span>
118 </button>
119
120 <my-video-download #videoDownloadModal></my-video-download>
121 </ng-container>
122 <ng-container *ngIf="isUserLoggedIn()">
123 <my-video-actions-dropdown
124 placement="bottom auto" buttonDirection="horizontal" [buttonStyled]="true" [video]="video" [videoCaptions]="videoCaptions"
125 (videoRemoved)="onVideoRemoved()" (modalOpened)="onModalOpened()"
126 ></my-video-actions-dropdown>
127 </ng-container>
115 </div> 128 </div>
116 129
117 <div class="video-info-likes-dislikes-bar-outer-container"> 130 <div class="video-info-likes-dislikes-bar-outer-container">
diff --git a/client/src/app/+videos/+video-watch/video-watch.component.ts b/client/src/app/+videos/+video-watch/video-watch.component.ts
index 4341514cd..e355faf25 100644
--- a/client/src/app/+videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/+videos/+video-watch/video-watch.component.ts
@@ -28,6 +28,7 @@ import { environment } from '../../../environments/environment'
28import { VideoShareComponent } from './modal/video-share.component' 28import { VideoShareComponent } from './modal/video-share.component'
29import { VideoSupportComponent } from './modal/video-support.component' 29import { VideoSupportComponent } from './modal/video-support.component'
30import { VideoWatchPlaylistComponent } from './video-watch-playlist.component' 30import { VideoWatchPlaylistComponent } from './video-watch-playlist.component'
31import { VideoDownloadComponent } from '@app/shared/shared-video-miniature'
31 32
32@Component({ 33@Component({
33 selector: 'my-video-watch', 34 selector: 'my-video-watch',
@@ -41,6 +42,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
41 @ViewChild('videoShareModal') videoShareModal: VideoShareComponent 42 @ViewChild('videoShareModal') videoShareModal: VideoShareComponent
42 @ViewChild('videoSupportModal') videoSupportModal: VideoSupportComponent 43 @ViewChild('videoSupportModal') videoSupportModal: VideoSupportComponent
43 @ViewChild('subscribeButton') subscribeButton: SubscribeButtonComponent 44 @ViewChild('subscribeButton') subscribeButton: SubscribeButtonComponent
45 @ViewChild('videoDownloadModal') videoDownloadModal: VideoDownloadComponent
44 46
45 player: any 47 player: any
46 playerElement: HTMLVideoElement 48 playerElement: HTMLVideoElement
@@ -201,6 +203,14 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
201 this.completeDescriptionShown = false 203 this.completeDescriptionShown = false
202 } 204 }
203 205
206 showDownloadModal () {
207 this.videoDownloadModal.show(this.video, this.videoCaptions)
208 }
209
210 isVideoDownloadable () {
211 return this.video && this.video instanceof VideoDetails && this.video.downloadEnabled
212 }
213
204 loadCompleteDescription () { 214 loadCompleteDescription () {
205 this.descriptionLoading = true 215 this.descriptionLoading = true
206 216