]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame_incremental - client/src/app/videos/+video-watch/modal/video-share.component.ts
Update client according to new model paths
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / +video-watch / modal / video-share.component.ts
... / ...
CommitLineData
1import { Component, ElementRef, Input, ViewChild } from '@angular/core'
2import { NotificationsService } from 'angular2-notifications'
3import { VideoDetails } from '../../../shared/video/video-details.model'
4import { buildVideoEmbed } from '../../../../assets/player/utils'
5import { I18n } from '@ngx-translate/i18n-polyfill'
6import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
7
8@Component({
9 selector: 'my-video-share',
10 templateUrl: './video-share.component.html',
11 styleUrls: [ './video-share.component.scss' ]
12})
13export class VideoShareComponent {
14 @Input() video: VideoDetails = null
15
16 @ViewChild('modal') modal: ElementRef
17
18 constructor (
19 private modalService: NgbModal,
20 private notificationsService: NotificationsService,
21 private i18n: I18n
22 ) {
23 // empty
24 }
25
26 show () {
27 this.modalService.open(this.modal)
28 }
29
30 getVideoIframeCode () {
31 return buildVideoEmbed(this.video.embedUrl)
32 }
33
34 getVideoUrl () {
35 return window.location.href
36 }
37
38 notSecure () {
39 return window.location.protocol === 'http:'
40 }
41
42 activateCopiedMessage () {
43 this.notificationsService.success(this.i18n('Success'), this.i18n('Copied'))
44 }
45}