diff options
author | Tanguy BERNARD <bernardtanguy1pro@gmail.com> | 2020-11-27 14:27:14 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-27 14:27:14 +0100 |
commit | 992f498e312efcde46f818ba719b50f1f958272f (patch) | |
tree | ab7f2e4e4be96097ea450e06243ccebe8acde8fa /client/src/app | |
parent | e6ad43168587eaa4a6ae1f239df233bc88b723d4 (diff) | |
download | PeerTube-992f498e312efcde46f818ba719b50f1f958272f.tar.gz PeerTube-992f498e312efcde46f818ba719b50f1f958272f.tar.zst PeerTube-992f498e312efcde46f818ba719b50f1f958272f.zip |
add title attribute for exact view counters (#3365)
Diffstat (limited to 'client/src/app')
4 files changed, 22 insertions, 4 deletions
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 @@ | |||
54 | <div class="video-info-date-views"> | 54 | <div class="video-info-date-views"> |
55 | <ng-container i18n>Published <my-date-toggle [date]="video.publishedAt"></my-date-toggle></ng-container> | 55 | <ng-container i18n>Published <my-date-toggle [date]="video.publishedAt"></my-date-toggle></ng-container> |
56 | 56 | ||
57 | <span i18n class="views"> | 57 | <span i18n |
58 | title="{{ getExactNumberOfViews() }}" | ||
59 | class="views"> | ||
58 | • {{ video.views | myNumberFormatter }} | 60 | • {{ video.views | myNumberFormatter }} |
59 | <ng-container *ngIf="!video.isLive">views</ng-container> | 61 | <ng-container *ngIf="!video.isLive">views</ng-container> |
60 | <ng-container *ngIf="video.isLive">viewers</ng-container> | 62 | <ng-container *ngIf="video.isLive">viewers</ng-container> |
@@ -71,7 +73,9 @@ | |||
71 | <div class="d-none d-md-block video-info-date-views"> | 73 | <div class="d-none d-md-block video-info-date-views"> |
72 | <ng-container i18n>Published <my-date-toggle [date]="video.publishedAt"></my-date-toggle></ng-container> | 74 | <ng-container i18n>Published <my-date-toggle [date]="video.publishedAt"></my-date-toggle></ng-container> |
73 | 75 | ||
74 | <span i18n class="views"> | 76 | <span i18n |
77 | title="{{ getExactNumberOfViews() }}" | ||
78 | class="views"> | ||
75 | • {{ video.views | myNumberFormatter }} | 79 | • {{ video.views | myNumberFormatter }} |
76 | <ng-container *ngIf="!video.isLive">views</ng-container> | 80 | <ng-container *ngIf="!video.isLive">views</ng-container> |
77 | <ng-container *ngIf="video.isLive">viewers</ng-container> | 81 | <ng-container *ngIf="video.isLive">viewers</ng-container> |
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 { | |||
219 | return $localize`You need to be <a href="/login">logged in</a> to rate this video.` | 219 | return $localize`You need to be <a href="/login">logged in</a> to rate this video.` |
220 | } | 220 | } |
221 | 221 | ||
222 | getExactNumberOfViews () { | ||
223 | return (this.video.views >= 1000) | ||
224 | ? `${this.video.views} ${this.video.isLive ? $localize`viewers` : $localize`views`}` | ||
225 | : '' | ||
226 | } | ||
227 | |||
222 | showMoreDescription () { | 228 | showMoreDescription () { |
223 | if (this.completeVideoDescription === undefined) { | 229 | if (this.completeVideoDescription === undefined) { |
224 | return this.loadCompleteDescription() | 230 | 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 @@ | |||
26 | <span class="video-miniature-created-at-views"> | 26 | <span class="video-miniature-created-at-views"> |
27 | <my-date-toggle *ngIf="displayOptions.date" [date]="video.publishedAt"></my-date-toggle> | 27 | <my-date-toggle *ngIf="displayOptions.date" [date]="video.publishedAt"></my-date-toggle> |
28 | 28 | ||
29 | <span class="views"> | 29 | <span class="views" title="{{ getExactNumberOfViews() }}"> |
30 | <ng-container *ngIf="displayOptions.date && displayOptions.views"> • </ng-container> | 30 | <ng-container *ngIf="displayOptions.date && displayOptions.views"> • </ng-container> |
31 | <ng-container i18n *ngIf="displayOptions.views">{video.views, plural, =1 {1 view} other {{{ video.views | myNumberFormatter }} views}}</ng-container> | 31 | <ng-container i18n *ngIf="displayOptions.views"> |
32 | {video.views, plural, =1 {1 view} other {{{ video.views | myNumberFormatter }} views}} | ||
33 | </ng-container> | ||
32 | </span> | 34 | </span> |
33 | </span> | 35 | </span> |
34 | 36 | ||
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 { | |||
190 | return this.video.videoChannelAvatarUrl | 190 | return this.video.videoChannelAvatarUrl |
191 | } | 191 | } |
192 | 192 | ||
193 | getExactNumberOfViews () { | ||
194 | return (this.video.views >= 1000 && this.displayOptions.views) | ||
195 | ? `${this.video.views} ${this.video.isLive ? $localize`viewers` : $localize`views`}` | ||
196 | : '' | ||
197 | } | ||
198 | |||
193 | loadActions () { | 199 | loadActions () { |
194 | if (this.displayVideoActions) this.showActions = true | 200 | if (this.displayVideoActions) this.showActions = true |
195 | 201 | ||