1
0
Fork 0
peertube/client/src/app/videos/+video-edit/video-add.component.ts

30 lines
1.0 KiB
TypeScript
Raw Normal View History

import { Component, ViewChild } from '@angular/core'
import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.service'
import { VideoImportComponent } from '@app/videos/+video-edit/video-import.component'
import { VideoUploadComponent } from '@app/videos/+video-edit/video-upload.component'
2016-03-14 12:50:19 +00:00
@Component({
selector: 'my-videos-add',
2017-12-07 15:32:06 +00:00
templateUrl: './video-add.component.html',
styleUrls: [ './video-add.component.scss' ]
2016-03-14 12:50:19 +00:00
})
export class VideoAddComponent implements CanComponentDeactivate {
@ViewChild('videoUpload') videoUpload: VideoUploadComponent
@ViewChild('videoImport') videoImport: VideoImportComponent
secondStepType: 'upload' | 'import'
videoName: string
onFirstStepDone (type: 'upload' | 'import', videoName: string) {
this.secondStepType = type
this.videoName = videoName
}
canDeactivate () {
if (this.secondStepType === 'upload') return this.videoUpload.canDeactivate()
if (this.secondStepType === 'import') return this.videoImport.canDeactivate()
2018-07-12 17:02:00 +00:00
return { canDeactivate: true }
2017-12-07 15:32:06 +00:00
}
2016-03-14 12:50:19 +00:00
}