From: Chocobozzz Date: Thu, 21 Dec 2017 09:49:52 +0000 (+0100) Subject: Add tooltip to likes/dislikes bar X-Git-Tag: v0.0.1-alpha~92 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=e91890011e100b677d35598e2feec7c6252e89bf;p=oweals%2Fpeertube.git Add tooltip to likes/dislikes bar --- diff --git a/client/src/app/videos/+video-watch/video-watch.component.html b/client/src/app/videos/+video-watch/video-watch.component.html index e9ca336dd..d9b572430 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.html +++ b/client/src/app/videos/+video-watch/video-watch.component.html @@ -65,7 +65,9 @@ {{ video.createdAt | myFromNow }} - {{ video.views | myNumberFormatter }} views -
+
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 { completeVideoDescription: string shortVideoDescription: string videoHTMLDescription = '' + likesBarTooltipText = '' private paramsSub: Subscription @@ -228,23 +229,24 @@ export class VideoWatchComponent implements OnInit, OnDestroy { removeVideo (event: Event) { event.preventDefault() - this.confirmService.confirm('Do you really want to delete this video?', 'Delete').subscribe( - res => { - if (res === false) return + this.confirmService.confirm('Do you really want to delete this video?', 'Delete') + .subscribe( + res => { + if (res === false) return - this.videoService.removeVideo(this.video.id) - .subscribe( - status => { - this.notificationsService.success('Success', `Video ${this.video.name} deleted.`) + this.videoService.removeVideo(this.video.id) + .subscribe( + status => { + this.notificationsService.success('Success', `Video ${this.video.name} deleted.`) - // Go back to the video-list. - this.router.navigate([ '/videos/list' ]) - }, + // Go back to the video-list. + this.router.navigate([ '/videos/list' ]) + }, - error => this.notificationsService.error('Error', error.text) - ) - } - ) + error => this.notificationsService.error('Error', error.text) + ) + } + ) } private updateVideoDescription (description: string) { @@ -261,6 +263,10 @@ export class VideoWatchComponent implements OnInit, OnDestroy { this.videoHTMLDescription = this.markdownService.markdownToHTML(this.video.description) } + private setVideoLikesBarTooltipText () { + this.likesBarTooltipText = `${this.video.likes} likes / ${this.video.dislikes} dislikes` + } + private handleError (err: any) { const errorMessage: string = typeof err === 'string' ? err : err.message let message = '' @@ -346,6 +352,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { } this.setVideoDescriptionHTML() + this.setVideoLikesBarTooltipText() this.setOpenGraphTags() this.checkUserRating() diff --git a/client/src/app/videos/+video-watch/video-watch.module.ts b/client/src/app/videos/+video-watch/video-watch.module.ts index 18319de1a..d0ed29d06 100644 --- a/client/src/app/videos/+video-watch/video-watch.module.ts +++ b/client/src/app/videos/+video-watch/video-watch.module.ts @@ -4,6 +4,7 @@ import { VideoWatchRoutingModule } from './video-watch-routing.module' import { MarkdownService } from '../shared' import { SharedModule } from '../../shared' import { ClipboardModule } from 'ngx-clipboard' +import { TooltipModule } from 'ngx-bootstrap/tooltip'; import { VideoWatchComponent } from './video-watch.component' import { VideoReportComponent } from './video-report.component' @@ -14,7 +15,8 @@ import { VideoDownloadComponent } from './video-download.component' imports: [ VideoWatchRoutingModule, SharedModule, - ClipboardModule + ClipboardModule, + TooltipModule.forRoot() ], declarations: [ diff --git a/client/src/sass/include/_bootstrap.scss b/client/src/sass/include/_bootstrap.scss index 4f0e2893e..bbf0fda22 100644 --- a/client/src/sass/include/_bootstrap.scss +++ b/client/src/sass/include/_bootstrap.scss @@ -41,7 +41,7 @@ // Components w/ JavaScript @import "~bootstrap-sass/assets/stylesheets/bootstrap/modals"; -//@import "~bootstrap-sass/assets/stylesheets/bootstrap/tooltip"; +@import "~bootstrap-sass/assets/stylesheets/bootstrap/tooltip"; //@import "~bootstrap-sass/assets/stylesheets/bootstrap/popovers"; //@import "~bootstrap-sass/assets/stylesheets/bootstrap/carousel"; diff --git a/client/src/sass/video-js-custom.scss b/client/src/sass/video-js-custom.scss index 724874995..715464ce8 100644 --- a/client/src/sass/video-js-custom.scss +++ b/client/src/sass/video-js-custom.scss @@ -50,12 +50,14 @@ $control-bar-height: 34px; display: block; visibility: hidden; opacity: 0; + transition-delay: 0.5s; + transition: visibility 0.5s, opacity 0.5s; } &.vjs-waiting .vjs-loading-spinner { visibility: visible; opacity: 1; - transition: visibility 0.5s, opacity 0.5s; + } .vjs-control-bar,