From 992f498e312efcde46f818ba719b50f1f958272f Mon Sep 17 00:00:00 2001 From: Tanguy BERNARD Date: Fri, 27 Nov 2020 14:27:14 +0100 Subject: add title attribute for exact view counters (#3365) --- client/src/app/+videos/+video-watch/video-watch.component.html | 8 ++++++-- client/src/app/+videos/+video-watch/video-watch.component.ts | 6 ++++++ .../shared/shared-video-miniature/video-miniature.component.html | 6 ++++-- .../shared/shared-video-miniature/video-miniature.component.ts | 6 ++++++ 4 files changed, 22 insertions(+), 4 deletions(-) (limited to 'client/src/app') 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 a90908dbe..d74334b13 100644 --- a/client/src/app/+videos/+video-watch/video-watch.component.html +++ b/client/src/app/+videos/+video-watch/video-watch.component.html @@ -54,7 +54,9 @@
Published - + • {{ video.views | myNumberFormatter }} views viewers @@ -71,7 +73,9 @@
Published - + • {{ video.views | myNumberFormatter }} views viewers 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 66af9709d..bc047489e 100644 --- a/client/src/app/+videos/+video-watch/video-watch.component.ts +++ b/client/src/app/+videos/+video-watch/video-watch.component.ts @@ -219,6 +219,12 @@ export class VideoWatchComponent implements OnInit, OnDestroy { return $localize`You need to be logged in to rate this video.` } + getExactNumberOfViews () { + return (this.video.views >= 1000) + ? `${this.video.views} ${this.video.isLive ? $localize`viewers` : $localize`views`}` + : '' + } + showMoreDescription () { if (this.completeVideoDescription === undefined) { return this.loadCompleteDescription() diff --git a/client/src/app/shared/shared-video-miniature/video-miniature.component.html b/client/src/app/shared/shared-video-miniature/video-miniature.component.html index a88b3bc9e..b323002e3 100644 --- a/client/src/app/shared/shared-video-miniature/video-miniature.component.html +++ b/client/src/app/shared/shared-video-miniature/video-miniature.component.html @@ -26,9 +26,11 @@ - + - {video.views, plural, =1 {1 view} other {{{ video.views | myNumberFormatter }} views}} + + {video.views, plural, =1 {1 view} other {{{ video.views | myNumberFormatter }} views}} + diff --git a/client/src/app/shared/shared-video-miniature/video-miniature.component.ts b/client/src/app/shared/shared-video-miniature/video-miniature.component.ts index cc5665ab1..e59255cf8 100644 --- a/client/src/app/shared/shared-video-miniature/video-miniature.component.ts +++ b/client/src/app/shared/shared-video-miniature/video-miniature.component.ts @@ -190,6 +190,12 @@ export class VideoMiniatureComponent implements OnInit { return this.video.videoChannelAvatarUrl } + getExactNumberOfViews () { + return (this.video.views >= 1000 && this.displayOptions.views) + ? `${this.video.views} ${this.video.isLive ? $localize`viewers` : $localize`views`}` + : '' + } + loadActions () { if (this.displayVideoActions) this.showActions = true -- cgit v1.2.3