From 529479f924b1849423fb087f9699f8ecb20610ca Mon Sep 17 00:00:00 2001 From: Dimitri Gilbert Date: Thu, 25 Jan 2018 18:40:23 +0100 Subject: 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 --- client/src/app/videos/+video-edit/video-add.component.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'client/src/app/videos/+video-edit/video-add.component.ts') 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 import { populateAsyncUserVideoChannels } from '../../shared/misc/utils' import { VideoEdit } from '../../shared/video/video-edit.model' import { VideoService } from '../../shared/video/video.service' +import { CanComponentDeactivate } from '@app/shared/can-deactivate-guard.service' @Component({ selector: 'my-videos-add', @@ -22,7 +23,7 @@ import { VideoService } from '../../shared/video/video.service' ] }) -export class VideoAddComponent extends FormReactive implements OnInit { +export class VideoAddComponent extends FormReactive implements OnInit, CanComponentDeactivate { @ViewChild('videofileInput') videofileInput isUploadingVideo = false @@ -84,6 +85,10 @@ export class VideoAddComponent extends FormReactive implements OnInit { }) } + canDeactivate () { + return !this.isUploadingVideo + } + fileChange () { this.uploadFirstStep() } -- cgit v1.2.3