Add tooltip to likes/dislikes bar

pull/175/head
Chocobozzz 2017-12-21 10:49:52 +01:00
parent 604abfbef5
commit e91890011e
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
5 changed files with 31 additions and 18 deletions

View File

@ -65,7 +65,9 @@
{{ video.createdAt | myFromNow }} - {{ video.views | myNumberFormatter }} views
</div>
<div *ngIf="video.likes !== 0 || video.dislikes !== 0" class="video-info-likes-dislikes-bar">
<div
class="video-info-likes-dislikes-bar"
*ngIf="video.likes !== 0 || video.dislikes !== 0" [tooltip]="likesBarTooltipText">
<div class="likes-bar" [ngStyle]="{ 'width.%': video.likesPercent }"></div>
</div>
</div>

View File

@ -44,6 +44,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
completeVideoDescription: string
shortVideoDescription: string
videoHTMLDescription = ''
likesBarTooltipText = ''
private paramsSub: Subscription
@ -228,7 +229,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
removeVideo (event: Event) {
event.preventDefault()
this.confirmService.confirm('Do you really want to delete this video?', 'Delete').subscribe(
this.confirmService.confirm('Do you really want to delete this video?', 'Delete')
.subscribe(
res => {
if (res === false) return
@ -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()

View File

@ -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: [

View File

@ -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";

View File

@ -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,