add url field to download modal
This commit is contained in:
parent
bc144e16ce
commit
bb5d74289b
|
@ -5,11 +5,21 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<div class="peertube-select-container">
|
<div class="form-group">
|
||||||
|
<div class="input-group input-group-sm">
|
||||||
|
<div class="input-group-prepend peertube-select-container">
|
||||||
<select [(ngModel)]="resolutionId">
|
<select [(ngModel)]="resolutionId">
|
||||||
<option *ngFor="let file of video.files" [value]="file.resolution.id">{{ file.resolution.label }}</option>
|
<option *ngFor="let file of video.files" [value]="file.resolution.id">{{ file.resolution.label }}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<input #urlInput (click)="urlInput.select()" type="text" class="form-control input-sm readonly" readonly [value]="getLink()" />
|
||||||
|
<div class="input-group-append">
|
||||||
|
<button [ngxClipboard]="urlInput" (click)="activateCopiedMessage()" type="button" class="btn btn-outline-secondary">
|
||||||
|
<span class="glyphicon glyphicon-copy"></span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="download-type">
|
<div class="download-type">
|
||||||
<div class="peertube-radio-container">
|
<div class="peertube-radio-container">
|
||||||
|
|
|
@ -2,7 +2,13 @@
|
||||||
@import 'mixins';
|
@import 'mixins';
|
||||||
|
|
||||||
.peertube-select-container {
|
.peertube-select-container {
|
||||||
@include peertube-select-container(130px);
|
@include peertube-select-container(100px);
|
||||||
|
border-top-right-radius: 0px;
|
||||||
|
border-bottom-right-radius: 0px;
|
||||||
|
|
||||||
|
select {
|
||||||
|
height: inherit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.download-type {
|
.download-type {
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
import { Component, ElementRef, Input, OnInit, ViewChild } from '@angular/core'
|
import { Component, ElementRef, Input, OnInit, ViewChild } from '@angular/core'
|
||||||
import { VideoDetails } from '../../../shared/video/video-details.model'
|
import { VideoDetails } from '../../../shared/video/video-details.model'
|
||||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
||||||
|
import { I18n } from '@ngx-translate/i18n-polyfill'
|
||||||
|
import { NotificationsService } from 'angular2-notifications'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-video-download',
|
selector: 'my-video-download',
|
||||||
|
@ -15,9 +17,11 @@ export class VideoDownloadComponent implements OnInit {
|
||||||
downloadType: 'direct' | 'torrent' | 'magnet' = 'torrent'
|
downloadType: 'direct' | 'torrent' | 'magnet' = 'torrent'
|
||||||
resolutionId: number | string = -1
|
resolutionId: number | string = -1
|
||||||
|
|
||||||
constructor (private modalService: NgbModal) {
|
constructor (
|
||||||
// empty
|
private notificationsService: NotificationsService,
|
||||||
}
|
private modalService: NgbModal,
|
||||||
|
private i18n: I18n
|
||||||
|
) { }
|
||||||
|
|
||||||
ngOnInit () {
|
ngOnInit () {
|
||||||
this.resolutionId = this.video.files[0].resolution.id
|
this.resolutionId = this.video.files[0].resolution.id
|
||||||
|
@ -28,6 +32,10 @@ export class VideoDownloadComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
download () {
|
download () {
|
||||||
|
window.location.assign(this.getLink())
|
||||||
|
}
|
||||||
|
|
||||||
|
getLink () {
|
||||||
// HTML select send us a string, so convert it to a number
|
// HTML select send us a string, so convert it to a number
|
||||||
this.resolutionId = parseInt(this.resolutionId.toString(), 10)
|
this.resolutionId = parseInt(this.resolutionId.toString(), 10)
|
||||||
|
|
||||||
|
@ -50,6 +58,11 @@ export class VideoDownloadComponent implements OnInit {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})()
|
})()
|
||||||
window.location.assign(link)
|
|
||||||
|
return link
|
||||||
|
}
|
||||||
|
|
||||||
|
activateCopiedMessage () {
|
||||||
|
this.notificationsService.success(this.i18n('Success'), this.i18n('Copied'))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue