aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/videos')
-rw-r--r--client/src/app/videos/+video-edit/video-add-routing.module.ts4
-rw-r--r--client/src/app/videos/+video-edit/video-add.component.ts7
-rw-r--r--client/src/app/videos/+video-edit/video-add.module.ts8
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'
4import { MetaGuard } from '@ngx-meta/core' 4import { MetaGuard } from '@ngx-meta/core'
5 5
6import { LoginGuard } from '../../core' 6import { LoginGuard } from '../../core'
7import { CanDeactivateGuard } from '../../shared/can-deactivate-guard.service'
7import { VideoAddComponent } from './video-add.component' 8import { VideoAddComponent } from './video-add.component'
8 9
9const videoAddRoutes: Routes = [ 10const 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
12import { populateAsyncUserVideoChannels } from '../../shared/misc/utils' 12import { populateAsyncUserVideoChannels } from '../../shared/misc/utils'
13import { VideoEdit } from '../../shared/video/video-edit.model' 13import { VideoEdit } from '../../shared/video/video-edit.model'
14import { VideoService } from '../../shared/video/video.service' 14import { VideoService } from '../../shared/video/video.service'
15import { 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
25export class VideoAddComponent extends FormReactive implements OnInit { 26export 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'
4import { VideoEditModule } from './shared/video-edit.module' 4import { VideoEditModule } from './shared/video-edit.module'
5import { VideoAddRoutingModule } from './video-add-routing.module' 5import { VideoAddRoutingModule } from './video-add-routing.module'
6import { VideoAddComponent } from './video-add.component' 6import { VideoAddComponent } from './video-add.component'
7import { 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})
26export class VideoAddModule { } 26export class VideoAddModule { }