aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/+video-watch/video-watch.component.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-12-06 17:15:59 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-12-06 17:15:59 +0100
commitb1fa3eba70dbd7d9e5b795ad251e293c88ebeee2 (patch)
treefffcdf00d7b475c5c2de7456a7ef3c4d47c71865 /client/src/app/videos/+video-watch/video-watch.component.ts
parentce0e281d46a7b574dcccb47958743656532bd312 (diff)
downloadPeerTube-b1fa3eba70dbd7d9e5b795ad251e293c88ebeee2.tar.gz
PeerTube-b1fa3eba70dbd7d9e5b795ad251e293c88ebeee2.tar.zst
PeerTube-b1fa3eba70dbd7d9e5b795ad251e293c88ebeee2.zip
Begin video watch design
Diffstat (limited to 'client/src/app/videos/+video-watch/video-watch.component.ts')
-rw-r--r--client/src/app/videos/+video-watch/video-watch.component.ts43
1 files changed, 21 insertions, 22 deletions
diff --git a/client/src/app/videos/+video-watch/video-watch.component.ts b/client/src/app/videos/+video-watch/video-watch.component.ts
index 48842602e..3c6951403 100644
--- a/client/src/app/videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/videos/+video-watch/video-watch.component.ts
@@ -10,6 +10,8 @@ import { UserVideoRateType, VideoRateType } from '../../../../../shared'
10import '../../../assets/player/peertube-videojs-plugin' 10import '../../../assets/player/peertube-videojs-plugin'
11import { AuthService, ConfirmService } from '../../core' 11import { AuthService, ConfirmService } from '../../core'
12import { VideoBlacklistService } from '../../shared' 12import { VideoBlacklistService } from '../../shared'
13import { Account } from '../../shared/account/account.model'
14import { Video } from '../../shared/video/video.model'
13import { MarkdownService } from '../shared' 15import { MarkdownService } from '../shared'
14import { VideoDownloadComponent } from './video-download.component' 16import { VideoDownloadComponent } from './video-download.component'
15import { VideoReportComponent } from './video-report.component' 17import { VideoReportComponent } from './video-report.component'
@@ -26,6 +28,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
26 @ViewChild('videoShareModal') videoShareModal: VideoShareComponent 28 @ViewChild('videoShareModal') videoShareModal: VideoShareComponent
27 @ViewChild('videoReportModal') videoReportModal: VideoReportComponent 29 @ViewChild('videoReportModal') videoReportModal: VideoReportComponent
28 30
31 otherVideos: Video[] = []
32
29 error = false 33 error = false
30 loading = false 34 loading = false
31 player: videojs.Player 35 player: videojs.Player
@@ -57,6 +61,13 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
57 ) {} 61 ) {}
58 62
59 ngOnInit () { 63 ngOnInit () {
64 this.videoService.getVideos({ currentPage: 1, itemsPerPage: 5 }, '-createdAt')
65 .subscribe(
66 data => this.otherVideos = data.videos,
67
68 err => console.error(err)
69 )
70
60 this.paramsSub = this.route.params.subscribe(routeParams => { 71 this.paramsSub = this.route.params.subscribe(routeParams => {
61 let uuid = routeParams['uuid'] 72 let uuid = routeParams['uuid']
62 this.videoService.getVideo(uuid).subscribe( 73 this.videoService.getVideo(uuid).subscribe(
@@ -114,27 +125,6 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
114 ) 125 )
115 } 126 }
116 127
117 removeVideo (event: Event) {
118 event.preventDefault()
119
120 this.confirmService.confirm('Do you really want to delete this video?', 'Delete').subscribe(
121 res => {
122 if (res === false) return
123
124 this.videoService.removeVideo(this.video.id)
125 .subscribe(
126 status => {
127 this.notificationsService.success('Success', `Video ${this.video.name} deleted.`)
128 // Go back to the video-list.
129 this.router.navigate(['/videos/list'])
130 },
131
132 error => this.notificationsService.error('Error', error.text)
133 )
134 }
135 )
136 }
137
138 blacklistVideo (event: Event) { 128 blacklistVideo (event: Event) {
139 event.preventDefault() 129 event.preventDefault()
140 130
@@ -165,7 +155,6 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
165 } 155 }
166 156
167 showLessDescription () { 157 showLessDescription () {
168
169 this.updateVideoDescription(this.shortVideoDescription) 158 this.updateVideoDescription(this.shortVideoDescription)
170 this.completeDescriptionShown = false 159 this.completeDescriptionShown = false
171 } 160 }
@@ -222,6 +211,16 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
222 return this.video.isBlackistableBy(this.authService.getUser()) 211 return this.video.isBlackistableBy(this.authService.getUser())
223 } 212 }
224 213
214 getAvatarPath () {
215 return Account.GET_ACCOUNT_AVATAR_PATH(this.video.account)
216 }
217
218 getVideoTags () {
219 if (!this.video || Array.isArray(this.video.tags) === false) return []
220
221 return this.video.tags.join(', ')
222 }
223
225 private updateVideoDescription (description: string) { 224 private updateVideoDescription (description: string) {
226 this.video.description = description 225 this.video.description = description
227 this.setVideoDescriptionHTML() 226 this.setVideoDescriptionHTML()