diff options
author | Leo Mouyna <mouynaleo@gmail.com> | 2019-05-14 23:38:59 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-05-16 09:12:58 +0200 |
commit | 11b3f14c758e57f9cb5f32d8140fa043094bb3d7 (patch) | |
tree | 1ae668be86b1df8c0ce3a5b6194b285411e60bf7 /client | |
parent | 2fbd5e25dd465f9d1169ec013ed6cc8e95b2b21a (diff) | |
download | PeerTube-11b3f14c758e57f9cb5f32d8140fa043094bb3d7.tar.gz PeerTube-11b3f14c758e57f9cb5f32d8140fa043094bb3d7.tar.zst PeerTube-11b3f14c758e57f9cb5f32d8140fa043094bb3d7.zip |
fix: Close modal after clicking on download
Use the NgActiveModal method to close it on a click by adding a specific
modalActive object and use it on download function.
See issue: Chocobozzz#1436
Diffstat (limited to 'client')
-rw-r--r-- | client/src/app/shared/video/modals/video-download.component.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/client/src/app/shared/video/modals/video-download.component.ts b/client/src/app/shared/video/modals/video-download.component.ts index d6d10d29e..a07560f87 100644 --- a/client/src/app/shared/video/modals/video-download.component.ts +++ b/client/src/app/shared/video/modals/video-download.component.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { Component, ElementRef, ViewChild } from '@angular/core' | 1 | import { Component, ElementRef, ViewChild } from '@angular/core' |
2 | import { VideoDetails } from '../../../shared/video/video-details.model' | 2 | import { VideoDetails } from '../../../shared/video/video-details.model' |
3 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | 3 | import { NgbActiveModal, NgbModal } from '@ng-bootstrap/ng-bootstrap' |
4 | import { I18n } from '@ngx-translate/i18n-polyfill' | 4 | import { I18n } from '@ngx-translate/i18n-polyfill' |
5 | import { Notifier } from '@app/core' | 5 | import { Notifier } from '@app/core' |
6 | 6 | ||
@@ -16,6 +16,7 @@ export class VideoDownloadComponent { | |||
16 | resolutionId: number | string = -1 | 16 | resolutionId: number | string = -1 |
17 | 17 | ||
18 | video: VideoDetails | 18 | video: VideoDetails |
19 | activeModal: NgbActiveModal | ||
19 | 20 | ||
20 | constructor ( | 21 | constructor ( |
21 | private notifier: Notifier, | 22 | private notifier: Notifier, |
@@ -26,9 +27,7 @@ export class VideoDownloadComponent { | |||
26 | show (video: VideoDetails) { | 27 | show (video: VideoDetails) { |
27 | this.video = video | 28 | this.video = video |
28 | 29 | ||
29 | const m = this.modalService.open(this.modal) | 30 | this.activeModal = this.modalService.open(this.modal) |
30 | m.result.then(() => this.onClose()) | ||
31 | .catch(() => this.onClose()) | ||
32 | 31 | ||
33 | this.resolutionId = this.video.files[0].resolution.id | 32 | this.resolutionId = this.video.files[0].resolution.id |
34 | } | 33 | } |
@@ -39,6 +38,7 @@ export class VideoDownloadComponent { | |||
39 | 38 | ||
40 | download () { | 39 | download () { |
41 | window.location.assign(this.getLink()) | 40 | window.location.assign(this.getLink()) |
41 | this.activeModal.close() | ||
42 | } | 42 | } |
43 | 43 | ||
44 | getLink () { | 44 | getLink () { |