Skip to content

Commit

Permalink
special display case for logged-out users to display download in watc…
Browse files Browse the repository at this point in the history
…h page
  • Loading branch information
rigelk committed Aug 4, 2020
1 parent 9a42363 commit 6863f81
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
21 changes: 17 additions & 4 deletions client/src/app/+videos/+video-watch/video-watch.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,23 @@ <h1 class="video-info-name">{{ video.name }}</h1>
</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">
Expand Down
10 changes: 10 additions & 0 deletions client/src/app/+videos/+video-watch/video-watch.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 6863f81

Please sign in to comment.