aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/+video-watch/modal/video-download.component.ts
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2018-09-23 19:43:41 +0200
committerRigel Kent <sendmemail@rigelk.eu>2018-09-23 19:43:41 +0200
commitbb5d74289b858fae04975477a9572b57ee6237c5 (patch)
treed5d03d8f5bf8988f2e32d56081fbff7debf76ed0 /client/src/app/videos/+video-watch/modal/video-download.component.ts
parentbc144e16ce5924e2f840e4df4099d8ea7b56edc4 (diff)
downloadPeerTube-bb5d74289b858fae04975477a9572b57ee6237c5.tar.gz
PeerTube-bb5d74289b858fae04975477a9572b57ee6237c5.tar.zst
PeerTube-bb5d74289b858fae04975477a9572b57ee6237c5.zip
add url field to download modal
Diffstat (limited to 'client/src/app/videos/+video-watch/modal/video-download.component.ts')
-rw-r--r--client/src/app/videos/+video-watch/modal/video-download.component.ts21
1 files changed, 17 insertions, 4 deletions
diff --git a/client/src/app/videos/+video-watch/modal/video-download.component.ts b/client/src/app/videos/+video-watch/modal/video-download.component.ts
index 1361146dd..b1b2c0623 100644
--- a/client/src/app/videos/+video-watch/modal/video-download.component.ts
+++ b/client/src/app/videos/+video-watch/modal/video-download.component.ts
@@ -1,6 +1,8 @@
1import { Component, ElementRef, Input, OnInit, ViewChild } from '@angular/core' 1import { Component, ElementRef, Input, OnInit, ViewChild } from '@angular/core'
2import { VideoDetails } from '../../../shared/video/video-details.model' 2import { VideoDetails } from '../../../shared/video/video-details.model'
3import { NgbModal } from '@ng-bootstrap/ng-bootstrap' 3import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
4import { I18n } from '@ngx-translate/i18n-polyfill'
5import { NotificationsService } from 'angular2-notifications'
4 6
5@Component({ 7@Component({
6 selector: 'my-video-download', 8 selector: 'my-video-download',
@@ -15,9 +17,11 @@ export class VideoDownloadComponent implements OnInit {
15 downloadType: 'direct' | 'torrent' | 'magnet' = 'torrent' 17 downloadType: 'direct' | 'torrent' | 'magnet' = 'torrent'
16 resolutionId: number | string = -1 18 resolutionId: number | string = -1
17 19
18 constructor (private modalService: NgbModal) { 20 constructor (
19 // empty 21 private notificationsService: NotificationsService,
20 } 22 private modalService: NgbModal,
23 private i18n: I18n
24 ) { }
21 25
22 ngOnInit () { 26 ngOnInit () {
23 this.resolutionId = this.video.files[0].resolution.id 27 this.resolutionId = this.video.files[0].resolution.id
@@ -28,6 +32,10 @@ export class VideoDownloadComponent implements OnInit {
28 } 32 }
29 33
30 download () { 34 download () {
35 window.location.assign(this.getLink())
36 }
37
38 getLink () {
31 // HTML select send us a string, so convert it to a number 39 // HTML select send us a string, so convert it to a number
32 this.resolutionId = parseInt(this.resolutionId.toString(), 10) 40 this.resolutionId = parseInt(this.resolutionId.toString(), 10)
33 41
@@ -50,6 +58,11 @@ export class VideoDownloadComponent implements OnInit {
50 } 58 }
51 } 59 }
52 })() 60 })()
53 window.location.assign(link) 61
62 return link
63 }
64
65 activateCopiedMessage () {
66 this.notificationsService.success(this.i18n('Success'), this.i18n('Copied'))
54 } 67 }
55} 68}