diff options
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.ts | 35 |
1 files changed, 21 insertions, 14 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 df4cfa666..c388b138b 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.ts +++ b/client/src/app/videos/+video-watch/video-watch.component.ts | |||
@@ -44,6 +44,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
44 | completeVideoDescription: string | 44 | completeVideoDescription: string |
45 | shortVideoDescription: string | 45 | shortVideoDescription: string |
46 | videoHTMLDescription = '' | 46 | videoHTMLDescription = '' |
47 | likesBarTooltipText = '' | ||
47 | 48 | ||
48 | private paramsSub: Subscription | 49 | private paramsSub: Subscription |
49 | 50 | ||
@@ -228,23 +229,24 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
228 | removeVideo (event: Event) { | 229 | removeVideo (event: Event) { |
229 | event.preventDefault() | 230 | event.preventDefault() |
230 | 231 | ||
231 | this.confirmService.confirm('Do you really want to delete this video?', 'Delete').subscribe( | 232 | this.confirmService.confirm('Do you really want to delete this video?', 'Delete') |
232 | res => { | 233 | .subscribe( |
233 | if (res === false) return | 234 | res => { |
235 | if (res === false) return | ||
234 | 236 | ||
235 | this.videoService.removeVideo(this.video.id) | 237 | this.videoService.removeVideo(this.video.id) |
236 | .subscribe( | 238 | .subscribe( |
237 | status => { | 239 | status => { |
238 | this.notificationsService.success('Success', `Video ${this.video.name} deleted.`) | 240 | this.notificationsService.success('Success', `Video ${this.video.name} deleted.`) |
239 | 241 | ||
240 | // Go back to the video-list. | 242 | // Go back to the video-list. |
241 | this.router.navigate([ '/videos/list' ]) | 243 | this.router.navigate([ '/videos/list' ]) |
242 | }, | 244 | }, |
243 | 245 | ||
244 | error => this.notificationsService.error('Error', error.text) | 246 | error => this.notificationsService.error('Error', error.text) |
245 | ) | 247 | ) |
246 | } | 248 | } |
247 | ) | 249 | ) |
248 | } | 250 | } |
249 | 251 | ||
250 | private updateVideoDescription (description: string) { | 252 | private updateVideoDescription (description: string) { |
@@ -261,6 +263,10 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
261 | this.videoHTMLDescription = this.markdownService.markdownToHTML(this.video.description) | 263 | this.videoHTMLDescription = this.markdownService.markdownToHTML(this.video.description) |
262 | } | 264 | } |
263 | 265 | ||
266 | private setVideoLikesBarTooltipText () { | ||
267 | this.likesBarTooltipText = `${this.video.likes} likes / ${this.video.dislikes} dislikes` | ||
268 | } | ||
269 | |||
264 | private handleError (err: any) { | 270 | private handleError (err: any) { |
265 | const errorMessage: string = typeof err === 'string' ? err : err.message | 271 | const errorMessage: string = typeof err === 'string' ? err : err.message |
266 | let message = '' | 272 | let message = '' |
@@ -346,6 +352,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
346 | } | 352 | } |
347 | 353 | ||
348 | this.setVideoDescriptionHTML() | 354 | this.setVideoDescriptionHTML() |
355 | this.setVideoLikesBarTooltipText() | ||
349 | 356 | ||
350 | this.setOpenGraphTags() | 357 | this.setOpenGraphTags() |
351 | this.checkUserRating() | 358 | this.checkUserRating() |