diff options
author | Chocobozzz <me@florianbigard.com> | 2020-11-27 15:57:38 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-11-27 15:57:38 +0100 |
commit | 4ec25ae825f8dee44d948b38d8216f9a239ff7b3 (patch) | |
tree | be3617c4060806c49e930af2f219e81640046388 /client | |
parent | 413b9729ee8218229a142dd5a79cd33d206b715f (diff) | |
download | PeerTube-4ec25ae825f8dee44d948b38d8216f9a239ff7b3.tar.gz PeerTube-4ec25ae825f8dee44d948b38d8216f9a239ff7b3.tar.zst PeerTube-4ec25ae825f8dee44d948b38d8216f9a239ff7b3.zip |
Refactor last PR
Diffstat (limited to 'client')
5 files changed, 13 insertions, 19 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 d74334b13..602214ac5 100644 --- a/client/src/app/+videos/+video-watch/video-watch.component.html +++ b/client/src/app/+videos/+video-watch/video-watch.component.html | |||
@@ -54,9 +54,7 @@ | |||
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 | 57 | <span i18n [title]="video.getExactNumberOfViews()" class="views"> |
58 | title="{{ getExactNumberOfViews() }}" | ||
59 | class="views"> | ||
60 | • {{ video.views | myNumberFormatter }} | 58 | • {{ video.views | myNumberFormatter }} |
61 | <ng-container *ngIf="!video.isLive">views</ng-container> | 59 | <ng-container *ngIf="!video.isLive">views</ng-container> |
62 | <ng-container *ngIf="video.isLive">viewers</ng-container> | 60 | <ng-container *ngIf="video.isLive">viewers</ng-container> |
@@ -73,9 +71,7 @@ | |||
73 | <div class="d-none d-md-block video-info-date-views"> | 71 | <div class="d-none d-md-block video-info-date-views"> |
74 | <ng-container i18n>Published <my-date-toggle [date]="video.publishedAt"></my-date-toggle></ng-container> | 72 | <ng-container i18n>Published <my-date-toggle [date]="video.publishedAt"></my-date-toggle></ng-container> |
75 | 73 | ||
76 | <span i18n | 74 | <span i18n [title]="video.getExactNumberOfViews()" class="views"> |
77 | title="{{ getExactNumberOfViews() }}" | ||
78 | class="views"> | ||
79 | • {{ video.views | myNumberFormatter }} | 75 | • {{ video.views | myNumberFormatter }} |
80 | <ng-container *ngIf="!video.isLive">views</ng-container> | 76 | <ng-container *ngIf="!video.isLive">views</ng-container> |
81 | <ng-container *ngIf="video.isLive">viewers</ng-container> | 77 | <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 bc047489e..66af9709d 100644 --- a/client/src/app/+videos/+video-watch/video-watch.component.ts +++ b/client/src/app/+videos/+video-watch/video-watch.component.ts | |||
@@ -219,12 +219,6 @@ 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 | |||
228 | showMoreDescription () { | 222 | showMoreDescription () { |
229 | if (this.completeVideoDescription === undefined) { | 223 | if (this.completeVideoDescription === undefined) { |
230 | return this.loadCompleteDescription() | 224 | return this.loadCompleteDescription() |
diff --git a/client/src/app/shared/shared-main/video/video.model.ts b/client/src/app/shared/shared-main/video/video.model.ts index 04e7bd717..adb6e884f 100644 --- a/client/src/app/shared/shared-main/video/video.model.ts +++ b/client/src/app/shared/shared-main/video/video.model.ts | |||
@@ -203,4 +203,14 @@ export class Video implements VideoServerModel { | |||
203 | canBeDuplicatedBy (user: AuthUser) { | 203 | canBeDuplicatedBy (user: AuthUser) { |
204 | return user && this.isLocal === false && user.hasRight(UserRight.MANAGE_VIDEOS_REDUNDANCIES) | 204 | return user && this.isLocal === false && user.hasRight(UserRight.MANAGE_VIDEOS_REDUNDANCIES) |
205 | } | 205 | } |
206 | |||
207 | getExactNumberOfViews () { | ||
208 | if (this.views < 1000) return '' | ||
209 | |||
210 | if (this.isLive) { | ||
211 | return $localize`${this.views} viewers` | ||
212 | } | ||
213 | |||
214 | return $localize`${this.views} views` | ||
215 | } | ||
206 | } | 216 | } |
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 b323002e3..395a4df97 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,7 +26,7 @@ | |||
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" title="{{ getExactNumberOfViews() }}"> | 29 | <span class="views" [title]="video.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"> | 31 | <ng-container i18n *ngIf="displayOptions.views"> |
32 | {video.views, plural, =1 {1 view} other {{{ video.views | myNumberFormatter }} views}} | 32 | {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 e59255cf8..cc5665ab1 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,12 +190,6 @@ 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 | |||
199 | loadActions () { | 193 | loadActions () { |
200 | if (this.displayVideoActions) this.showActions = true | 194 | if (this.displayVideoActions) this.showActions = true |
201 | 195 | ||