diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-11-04 16:23:18 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-11-04 16:23:18 +0100 |
commit | 3154f38219ea6eb55532f38fee43d46821a020ee (patch) | |
tree | baa5586d83de77387b4559fe6e98e3a95334cbc0 /client/src/app | |
parent | d1992b93f0f4a4408f803d6320cd26a713e22d5b (diff) | |
download | PeerTube-3154f38219ea6eb55532f38fee43d46821a020ee.tar.gz PeerTube-3154f38219ea6eb55532f38fee43d46821a020ee.tar.zst PeerTube-3154f38219ea6eb55532f38fee43d46821a020ee.zip |
Client: allow to copy magnet uri
Diffstat (limited to 'client/src/app')
-rw-r--r-- | client/src/app/app.component.ts | 13 | ||||
-rw-r--r-- | client/src/app/app.module.ts | 2 | ||||
-rw-r--r-- | client/src/app/videos/video-watch/video-watch.component.html | 19 | ||||
-rw-r--r-- | client/src/app/videos/video-watch/video-watch.component.ts | 14 |
4 files changed, 41 insertions, 7 deletions
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 @@ | |||
1 | import { Component } from '@angular/core'; | 1 | import { Component, ViewContainerRef } from '@angular/core'; |
2 | import { Router } from '@angular/router'; | 2 | import { 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 | ||
10 | export class AppComponent { | 10 | export 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'; | |||
9 | import { DropdownModule } from 'ng2-bootstrap/components/dropdown'; | 9 | import { DropdownModule } from 'ng2-bootstrap/components/dropdown'; |
10 | import { ProgressbarModule } from 'ng2-bootstrap/components/progressbar'; | 10 | import { ProgressbarModule } from 'ng2-bootstrap/components/progressbar'; |
11 | import { PaginationModule } from 'ng2-bootstrap/components/pagination'; | 11 | import { PaginationModule } from 'ng2-bootstrap/components/pagination'; |
12 | import { ModalModule } from 'ng2-bootstrap/components/modal'; | ||
12 | import { FileUploadModule } from 'ng2-file-upload/ng2-file-upload'; | 13 | import { 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">×</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 @@ | |||
1 | import { Component, ElementRef, NgZone, OnDestroy, OnInit } from '@angular/core'; | 1 | import { Component, ElementRef, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core'; |
2 | import { ActivatedRoute } from '@angular/router'; | 2 | import { ActivatedRoute } from '@angular/router'; |
3 | 3 | ||
4 | import { ModalDirective } from 'ng2-bootstrap/components/modal'; | ||
5 | |||
4 | import { Video, VideoService } from '../shared'; | 6 | import { Video, VideoService } from '../shared'; |
5 | import { WebTorrentService } from './webtorrent.service'; | 7 | import { WebTorrentService } from './webtorrent.service'; |
6 | 8 | ||
@@ -13,6 +15,8 @@ import { WebTorrentService } from './webtorrent.service'; | |||
13 | export class VideoWatchComponent implements OnInit, OnDestroy { | 15 | export 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.'); |