2018-08-02 13:34:09 +00:00
|
|
|
import { Component, ViewChild } from '@angular/core'
|
2018-01-25 18:01:13 +00:00
|
|
|
import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.service'
|
2018-08-02 13:34:09 +00:00
|
|
|
import { VideoImportComponent } from '@app/videos/+video-edit/video-import.component'
|
|
|
|
import { VideoUploadComponent } from '@app/videos/+video-edit/video-upload.component'
|
2016-04-14 20:07:46 +00:00
|
|
|
|
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',
|
2018-08-02 13:34:09 +00:00
|
|
|
styleUrls: [ './video-add.component.scss' ]
|
2016-03-14 12:50:19 +00:00
|
|
|
})
|
2018-08-02 13:34:09 +00:00
|
|
|
export class VideoAddComponent implements CanComponentDeactivate {
|
|
|
|
@ViewChild('videoUpload') videoUpload: VideoUploadComponent
|
|
|
|
@ViewChild('videoImport') videoImport: VideoImportComponent
|
2017-09-14 15:06:31 +00:00
|
|
|
|
2018-08-02 13:34:09 +00:00
|
|
|
secondStepType: 'upload' | 'import'
|
|
|
|
videoName: string
|
2018-06-15 14:52:15 +00:00
|
|
|
|
2018-08-02 13:34:09 +00:00
|
|
|
onFirstStepDone (type: 'upload' | 'import', videoName: string) {
|
|
|
|
this.secondStepType = type
|
|
|
|
this.videoName = videoName
|
2018-01-25 18:01:13 +00:00
|
|
|
}
|
|
|
|
|
2018-01-25 17:40:23 +00:00
|
|
|
canDeactivate () {
|
2018-08-02 13:34:09 +00:00
|
|
|
if (this.secondStepType === 'upload') return this.videoUpload.canDeactivate()
|
|
|
|
if (this.secondStepType === 'import') return this.videoImport.canDeactivate()
|
2018-07-12 17:02:00 +00:00
|
|
|
|
2018-08-02 13:34:09 +00:00
|
|
|
return { canDeactivate: true }
|
2017-12-07 15:32:06 +00:00
|
|
|
}
|
2016-03-14 12:50:19 +00:00
|
|
|
}
|