aboutsummaryrefslogtreecommitdiffhomepage
path: root/client
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-11-04 16:23:18 +0100
committerChocobozzz <florian.bigard@gmail.com>2016-11-04 16:23:18 +0100
commit3154f38219ea6eb55532f38fee43d46821a020ee (patch)
treebaa5586d83de77387b4559fe6e98e3a95334cbc0 /client
parentd1992b93f0f4a4408f803d6320cd26a713e22d5b (diff)
downloadPeerTube-3154f38219ea6eb55532f38fee43d46821a020ee.tar.gz
PeerTube-3154f38219ea6eb55532f38fee43d46821a020ee.tar.zst
PeerTube-3154f38219ea6eb55532f38fee43d46821a020ee.zip
Client: allow to copy magnet uri
Diffstat (limited to 'client')
-rw-r--r--client/.bootstraprc4
-rw-r--r--client/src/app/app.component.ts13
-rw-r--r--client/src/app/app.module.ts2
-rw-r--r--client/src/app/videos/video-watch/video-watch.component.html19
-rw-r--r--client/src/app/videos/video-watch/video-watch.component.ts14
5 files changed, 43 insertions, 9 deletions
diff --git a/client/.bootstraprc b/client/.bootstraprc
index dd6c2128c..b7468b2fe 100644
--- a/client/.bootstraprc
+++ b/client/.bootstraprc
@@ -97,10 +97,10 @@ styles:
97 panels: false 97 panels: false
98 wells: false 98 wells: false
99 responsive-embed: true 99 responsive-embed: true
100 close: false 100 close: true
101 101
102 # Components w/ JavaScript 102 # Components w/ JavaScript
103 modals: false 103 modals: true
104 tooltip: false 104 tooltip: false
105 popovers: false 105 popovers: false
106 carousel: false 106 carousel: false
diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts
index d6b83c684..01d3f5deb 100644
--- a/client/src/app/app.component.ts
+++ b/client/src/app/app.component.ts
@@ -1,14 +1,17 @@
1import { Component } from '@angular/core'; 1import { Component, ViewContainerRef } from '@angular/core';
2import { Router } from '@angular/router'; 2import { Router } from '@angular/router';
3 3
4@Component({ 4@Component({
5 selector: 'my-app', 5 selector: 'my-app',
6 templateUrl: './app.component.html', 6 templateUrl: './app.component.html',
7 styleUrls: [ './app.component.scss' ] 7 styleUrls: [ './app.component.scss' ]
8}) 8})
9 9
10export class AppComponent { 10export class AppComponent {
11 constructor(private router: Router) {} 11 constructor(
12 private router: Router,
13 viewContainerRef: ViewContainerRef
14 ) {}
12 15
13 isInAdmin() { 16 isInAdmin() {
14 return this.router.url.indexOf('/admin/') !== -1; 17 return this.router.url.indexOf('/admin/') !== -1;
diff --git a/client/src/app/app.module.ts b/client/src/app/app.module.ts
index 80734f7a2..939af6309 100644
--- a/client/src/app/app.module.ts
+++ b/client/src/app/app.module.ts
@@ -9,6 +9,7 @@ import { BytesPipe } from 'angular-pipes/src/math/bytes.pipe';
9import { DropdownModule } from 'ng2-bootstrap/components/dropdown'; 9import { DropdownModule } from 'ng2-bootstrap/components/dropdown';
10import { ProgressbarModule } from 'ng2-bootstrap/components/progressbar'; 10import { ProgressbarModule } from 'ng2-bootstrap/components/progressbar';
11import { PaginationModule } from 'ng2-bootstrap/components/pagination'; 11import { PaginationModule } from 'ng2-bootstrap/components/pagination';
12import { ModalModule } from 'ng2-bootstrap/components/modal';
12import { FileUploadModule } from 'ng2-file-upload/ng2-file-upload'; 13import { FileUploadModule } from 'ng2-file-upload/ng2-file-upload';
13 14
14/* 15/*
@@ -115,6 +116,7 @@ const APP_PROVIDERS = [
115 DropdownModule, 116 DropdownModule,
116 ProgressbarModule, 117 ProgressbarModule,
117 PaginationModule, 118 PaginationModule,
119 ModalModule,
118 FileUploadModule 120 FileUploadModule
119 ], 121 ],
120 providers: [ // expose our Services and Providers into Angular's dependency injection 122 providers: [ // expose our Services and Providers into Angular's dependency injection
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 14947da88..d75ed3538 100644
--- a/client/src/app/videos/video-watch/video-watch.component.html
+++ b/client/src/app/videos/video-watch/video-watch.component.html
@@ -50,7 +50,7 @@
50 </div> 50 </div>
51 51
52 <div id="video-actions" class="col-md-4 text-right"> 52 <div id="video-actions" class="col-md-4 text-right">
53 <button title="Get magnet URI" id="magnet-uri" class="btn btn-default"> 53 <button title="Get magnet URI" id="magnet-uri" class="btn btn-default" (click)="showMagnetUriModal()">
54 <span class="glyphicon glyphicon-magnet"></span> Magnet 54 <span class="glyphicon glyphicon-magnet"></span> Magnet
55 </button> 55 </button>
56 </div> 56 </div>
@@ -72,3 +72,20 @@
72 </div> 72 </div>
73</div> 73</div>
74 74
75<div *ngIf="video !== null" bsModal #magnetUriModal="bs-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="magnetUriModal" aria-hidden="true">
76 <div class="modal-dialog">
77 <div class="modal-content">
78
79 <div class="modal-header">
80 <button type="button" class="close" aria-label="Close" (click)="hideMagnetUriModal()">
81 <span aria-hidden="true">&times;</span>
82 </button>
83 <h4 class="modal-title">Magnet Uri</h4>
84 </div>
85
86 <div class="modal-body">
87 <input #magnetUriInput (click)="magnetUriInput.select()" type="text" class="form-control input-sm" readonly [value]="video.magnetUri" />
88 </div>
89 </div>
90 </div>
91</div>
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 9a36c17e2..736ca7d5a 100644
--- a/client/src/app/videos/video-watch/video-watch.component.ts
+++ b/client/src/app/videos/video-watch/video-watch.component.ts
@@ -1,6 +1,8 @@
1import { Component, ElementRef, NgZone, OnDestroy, OnInit } from '@angular/core'; 1import { Component, ElementRef, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core';
2import { ActivatedRoute } from '@angular/router'; 2import { ActivatedRoute } from '@angular/router';
3 3
4import { ModalDirective } from 'ng2-bootstrap/components/modal';
5
4import { Video, VideoService } from '../shared'; 6import { Video, VideoService } from '../shared';
5import { WebTorrentService } from './webtorrent.service'; 7import { WebTorrentService } from './webtorrent.service';
6 8
@@ -13,6 +15,8 @@ import { WebTorrentService } from './webtorrent.service';
13export class VideoWatchComponent implements OnInit, OnDestroy { 15export class VideoWatchComponent implements OnInit, OnDestroy {
14 private static LOADTIME_TOO_LONG: number = 30000; 16 private static LOADTIME_TOO_LONG: number = 30000;
15 17
18 @ViewChild('magnetUriModal') magnetUriModal: ModalDirective;
19
16 downloadSpeed: number; 20 downloadSpeed: number;
17 error: boolean = false; 21 error: boolean = false;
18 loading: boolean = false; 22 loading: boolean = false;
@@ -87,6 +91,14 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
87 }); 91 });
88 } 92 }
89 93
94 showMagnetUriModal() {
95 this.magnetUriModal.show();
96 }
97
98 hideMagnetUriModal() {
99 this.magnetUriModal.hide();
100 }
101
90 private loadTooLong() { 102 private loadTooLong() {
91 this.error = true; 103 this.error = true;
92 console.error('The video load seems to be abnormally long.'); 104 console.error('The video load seems to be abnormally long.');