aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/+video-edit/video-update.component.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-07-25 10:28:43 +0200
committerChocobozzz <me@florianbigard.com>2018-07-25 10:28:43 +0200
commit772d5642ba617865519ca5e590061adf174866d4 (patch)
tree27e2f3c9a78a4de67128f005d2bd73a5eecca804 /client/src/app/videos/+video-edit/video-update.component.ts
parentd73c98884ec7f970ed95a01fb2d445d10c53c817 (diff)
downloadPeerTube-772d5642ba617865519ca5e590061adf174866d4.tar.gz
PeerTube-772d5642ba617865519ca5e590061adf174866d4.tar.zst
PeerTube-772d5642ba617865519ca5e590061adf174866d4.zip
Improve captions UX (at least I've tried)
Diffstat (limited to 'client/src/app/videos/+video-edit/video-update.component.ts')
-rw-r--r--client/src/app/videos/+video-edit/video-update.component.ts15
1 files changed, 14 insertions, 1 deletions
diff --git a/client/src/app/videos/+video-edit/video-update.component.ts b/client/src/app/videos/+video-edit/video-update.component.ts
index 952fe0293..798c48f3c 100644
--- a/client/src/app/videos/+video-edit/video-update.component.ts
+++ b/client/src/app/videos/+video-edit/video-update.component.ts
@@ -29,6 +29,8 @@ export class VideoUpdateComponent extends FormReactive implements OnInit {
29 schedulePublicationPossible = false 29 schedulePublicationPossible = false
30 videoCaptions: VideoCaptionEdit[] = [] 30 videoCaptions: VideoCaptionEdit[] = []
31 31
32 private updateDone = false
33
32 constructor ( 34 constructor (
33 protected formValidatorService: FormValidatorService, 35 protected formValidatorService: FormValidatorService,
34 private route: ActivatedRoute, 36 private route: ActivatedRoute,
@@ -65,7 +67,7 @@ export class VideoUpdateComponent extends FormReactive implements OnInit {
65 this.schedulePublicationPossible = this.video.privacy === VideoPrivacy.PRIVATE 67 this.schedulePublicationPossible = this.video.privacy === VideoPrivacy.PRIVATE
66 } 68 }
67 69
68 // FIXME: Angular does not detec 70 // FIXME: Angular does not detect the change inside this subscription, so use the patched setTimeout
69 setTimeout(() => this.hydrateFormFromVideo()) 71 setTimeout(() => this.hydrateFormFromVideo())
70 }, 72 },
71 73
@@ -76,6 +78,16 @@ export class VideoUpdateComponent extends FormReactive implements OnInit {
76 ) 78 )
77 } 79 }
78 80
81 canDeactivate () {
82 if (this.updateDone === true) return { canDeactivate: true }
83
84 for (const caption of this.videoCaptions) {
85 if (caption.action) return { canDeactivate: false }
86 }
87
88 return { canDeactivate: this.formChanged === false }
89 }
90
79 checkForm () { 91 checkForm () {
80 this.forceCheck() 92 this.forceCheck()
81 93
@@ -100,6 +112,7 @@ export class VideoUpdateComponent extends FormReactive implements OnInit {
100 ) 112 )
101 .subscribe( 113 .subscribe(
102 () => { 114 () => {
115 this.updateDone = true
103 this.isUpdatingVideo = false 116 this.isUpdatingVideo = false
104 this.loadingBar.complete() 117 this.loadingBar.complete()
105 this.notificationsService.success(this.i18n('Success'), this.i18n('Video updated.')) 118 this.notificationsService.success(this.i18n('Success'), this.i18n('Video updated.'))