diff options
Diffstat (limited to 'client/src/app/videos')
3 files changed, 13 insertions, 6 deletions
diff --git a/client/src/app/videos/+video-edit/video-add-routing.module.ts b/client/src/app/videos/+video-edit/video-add-routing.module.ts index e7a32627c..9541a2bd1 100644 --- a/client/src/app/videos/+video-edit/video-add-routing.module.ts +++ b/client/src/app/videos/+video-edit/video-add-routing.module.ts | |||
@@ -4,13 +4,15 @@ import { RouterModule, Routes } from '@angular/router' | |||
4 | import { MetaGuard } from '@ngx-meta/core' | 4 | import { MetaGuard } from '@ngx-meta/core' |
5 | 5 | ||
6 | import { LoginGuard } from '../../core' | 6 | import { LoginGuard } from '../../core' |
7 | import { CanDeactivateGuard } from '../../shared/can-deactivate-guard.service' | ||
7 | import { VideoAddComponent } from './video-add.component' | 8 | import { VideoAddComponent } from './video-add.component' |
8 | 9 | ||
9 | const videoAddRoutes: Routes = [ | 10 | const videoAddRoutes: Routes = [ |
10 | { | 11 | { |
11 | path: '', | 12 | path: '', |
12 | component: VideoAddComponent, | 13 | component: VideoAddComponent, |
13 | canActivate: [ MetaGuard, LoginGuard ] | 14 | canActivate: [ MetaGuard, LoginGuard ], |
15 | canDeactivate: [CanDeactivateGuard] | ||
14 | } | 16 | } |
15 | ] | 17 | ] |
16 | 18 | ||
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 | } |
diff --git a/client/src/app/videos/+video-edit/video-add.module.ts b/client/src/app/videos/+video-edit/video-add.module.ts index 1efecdf4d..af9696a03 100644 --- a/client/src/app/videos/+video-edit/video-add.module.ts +++ b/client/src/app/videos/+video-edit/video-add.module.ts | |||
@@ -4,6 +4,7 @@ import { SharedModule } from '../../shared' | |||
4 | import { VideoEditModule } from './shared/video-edit.module' | 4 | import { VideoEditModule } from './shared/video-edit.module' |
5 | import { VideoAddRoutingModule } from './video-add-routing.module' | 5 | import { VideoAddRoutingModule } from './video-add-routing.module' |
6 | import { VideoAddComponent } from './video-add.component' | 6 | import { VideoAddComponent } from './video-add.component' |
7 | import { CanDeactivateGuard } from '../../shared/can-deactivate-guard.service' | ||
7 | 8 | ||
8 | @NgModule({ | 9 | @NgModule({ |
9 | imports: [ | 10 | imports: [ |
@@ -12,15 +13,14 @@ import { VideoAddComponent } from './video-add.component' | |||
12 | SharedModule, | 13 | SharedModule, |
13 | ProgressBarModule | 14 | ProgressBarModule |
14 | ], | 15 | ], |
15 | |||
16 | declarations: [ | 16 | declarations: [ |
17 | VideoAddComponent | 17 | VideoAddComponent |
18 | ], | 18 | ], |
19 | |||
20 | exports: [ | 19 | exports: [ |
21 | VideoAddComponent | 20 | VideoAddComponent |
22 | ], | 21 | ], |
23 | 22 | providers: [ | |
24 | providers: [ ] | 23 | CanDeactivateGuard |
24 | ] | ||
25 | }) | 25 | }) |
26 | export class VideoAddModule { } | 26 | export class VideoAddModule { } |