diff options
author | Dimitri Gilbert <dimitri.gilbert@gmail.com> | 2018-01-25 18:40:23 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-01-25 18:40:23 +0100 |
commit | 529479f924b1849423fb087f9699f8ecb20610ca (patch) | |
tree | 3d65b27cb34f3cc187c1bb3af867b254166fee2e /client/src/app/videos/+video-edit/video-add.component.ts | |
parent | c360c49456a27529268722fb7c645819cff59486 (diff) | |
download | PeerTube-529479f924b1849423fb087f9699f8ecb20610ca.tar.gz PeerTube-529479f924b1849423fb087f9699f8ecb20610ca.tar.zst PeerTube-529479f924b1849423fb087f9699f8ecb20610ca.zip |
Issue #195 : When uploading, warn when the user quits the page (#222)
* issue #195
* fixing missing provider definition
* fix styling issue
* fix styling issue
* removed unecessary code
* using angular confirmService instead of window.confirm
* gitignore unecessary folders
* style fixes
* using a generic canDeactivateGuard
* fixing lint style
Diffstat (limited to 'client/src/app/videos/+video-edit/video-add.component.ts')
-rw-r--r-- | client/src/app/videos/+video-edit/video-add.component.ts | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/client/src/app/videos/+video-edit/video-add.component.ts b/client/src/app/videos/+video-edit/video-add.component.ts index 73efd60bf..58eccef48 100644 --- a/client/src/app/videos/+video-edit/video-add.component.ts +++ b/client/src/app/videos/+video-edit/video-add.component.ts | |||
@@ -12,6 +12,7 @@ import { ValidatorMessage } from '../../shared/forms/form-validators/validator-m | |||
12 | import { populateAsyncUserVideoChannels } from '../../shared/misc/utils' | 12 | import { populateAsyncUserVideoChannels } from '../../shared/misc/utils' |
13 | import { VideoEdit } from '../../shared/video/video-edit.model' | 13 | import { VideoEdit } from '../../shared/video/video-edit.model' |
14 | import { VideoService } from '../../shared/video/video.service' | 14 | import { VideoService } from '../../shared/video/video.service' |
15 | import { CanComponentDeactivate } from '@app/shared/can-deactivate-guard.service' | ||
15 | 16 | ||
16 | @Component({ | 17 | @Component({ |
17 | selector: 'my-videos-add', | 18 | selector: 'my-videos-add', |
@@ -22,7 +23,7 @@ import { VideoService } from '../../shared/video/video.service' | |||
22 | ] | 23 | ] |
23 | }) | 24 | }) |
24 | 25 | ||
25 | export class VideoAddComponent extends FormReactive implements OnInit { | 26 | export class VideoAddComponent extends FormReactive implements OnInit, CanComponentDeactivate { |
26 | @ViewChild('videofileInput') videofileInput | 27 | @ViewChild('videofileInput') videofileInput |
27 | 28 | ||
28 | isUploadingVideo = false | 29 | isUploadingVideo = false |
@@ -84,6 +85,10 @@ export class VideoAddComponent extends FormReactive implements OnInit { | |||
84 | }) | 85 | }) |
85 | } | 86 | } |
86 | 87 | ||
88 | canDeactivate () { | ||
89 | return !this.isUploadingVideo | ||
90 | } | ||
91 | |||
87 | fileChange () { | 92 | fileChange () { |
88 | this.uploadFirstStep() | 93 | this.uploadFirstStep() |
89 | } | 94 | } |