diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-04-04 21:37:03 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-04-04 21:37:03 +0200 |
commit | 92fb909c9b4a92a00b0d0da7629e6fb003de281b (patch) | |
tree | 8119c6720d5dec0474983501843f1e699fde150a /client/src/app/videos/video-list | |
parent | 1d49e1e27d63db1dfc9a7fd28c9902f488831a89 (diff) | |
download | PeerTube-92fb909c9b4a92a00b0d0da7629e6fb003de281b.tar.gz PeerTube-92fb909c9b4a92a00b0d0da7629e6fb003de281b.tar.zst PeerTube-92fb909c9b4a92a00b0d0da7629e6fb003de281b.zip |
Client: Handle NSFW video
Diffstat (limited to 'client/src/app/videos/video-list')
3 files changed, 34 insertions, 3 deletions
diff --git a/client/src/app/videos/video-list/video-miniature.component.html b/client/src/app/videos/video-list/video-miniature.component.html index b2bf35435..94b892698 100644 --- a/client/src/app/videos/video-list/video-miniature.component.html +++ b/client/src/app/videos/video-list/video-miniature.component.html | |||
@@ -3,7 +3,11 @@ | |||
3 | [routerLink]="['/videos/watch', video.id]" [attr.title]="video.description" | 3 | [routerLink]="['/videos/watch', video.id]" [attr.title]="video.description" |
4 | class="video-miniature-thumbnail" | 4 | class="video-miniature-thumbnail" |
5 | > | 5 | > |
6 | <img [attr.src]="video.thumbnailPath" alt="video thumbnail" /> | 6 | <img *ngIf="isVideoNSFWForThisUser() === false" [attr.src]="video.thumbnailPath" alt="video thumbnail" /> |
7 | <div *ngIf="isVideoNSFWForThisUser()" class="thumbnail-nsfw"> | ||
8 | NSFW | ||
9 | </div> | ||
10 | |||
7 | <span class="video-miniature-duration">{{ video.duration }}</span> | 11 | <span class="video-miniature-duration">{{ video.duration }}</span> |
8 | </a> | 12 | </a> |
9 | <span | 13 | <span |
@@ -13,7 +17,7 @@ | |||
13 | 17 | ||
14 | <div class="video-miniature-informations"> | 18 | <div class="video-miniature-informations"> |
15 | <span class="video-miniature-name-tags"> | 19 | <span class="video-miniature-name-tags"> |
16 | <a [routerLink]="['/videos/watch', video.id]" [attr.title]="video.name" class="video-miniature-name">{{ video.name }}</a> | 20 | <a [routerLink]="['/videos/watch', video.id]" [attr.title]="getVideoName()" class="video-miniature-name">{{ getVideoName() }}</a> |
17 | 21 | ||
18 | <div class="video-miniature-tags"> | 22 | <div class="video-miniature-tags"> |
19 | <span *ngFor="let tag of video.tags" class="video-miniature-tag"> | 23 | <span *ngFor="let tag of video.tags" class="video-miniature-tag"> |
diff --git a/client/src/app/videos/video-list/video-miniature.component.scss b/client/src/app/videos/video-list/video-miniature.component.scss index b5d24271a..b8e90e8c5 100644 --- a/client/src/app/videos/video-list/video-miniature.component.scss +++ b/client/src/app/videos/video-list/video-miniature.component.scss | |||
@@ -15,6 +15,21 @@ | |||
15 | display: inline-block; | 15 | display: inline-block; |
16 | position: relative; | 16 | position: relative; |
17 | 17 | ||
18 | &:hover { | ||
19 | text-decoration: none !important; | ||
20 | } | ||
21 | |||
22 | .thumbnail-nsfw { | ||
23 | background-color: #000; | ||
24 | color: #fff; | ||
25 | text-align: center; | ||
26 | font-size: 30px; | ||
27 | line-height: 110px; | ||
28 | |||
29 | width: 200px; | ||
30 | height: 110px; | ||
31 | } | ||
32 | |||
18 | .video-miniature-duration { | 33 | .video-miniature-duration { |
19 | position: absolute; | 34 | position: absolute; |
20 | right: 5px; | 35 | right: 5px; |
diff --git a/client/src/app/videos/video-list/video-miniature.component.ts b/client/src/app/videos/video-list/video-miniature.component.ts index ba4715597..888026dde 100644 --- a/client/src/app/videos/video-list/video-miniature.component.ts +++ b/client/src/app/videos/video-list/video-miniature.component.ts | |||
@@ -2,7 +2,7 @@ import { Component, Input, Output, EventEmitter } from '@angular/core'; | |||
2 | 2 | ||
3 | import { NotificationsService } from 'angular2-notifications'; | 3 | import { NotificationsService } from 'angular2-notifications'; |
4 | 4 | ||
5 | import { ConfirmService } from '../../core'; | 5 | import { ConfirmService, ConfigService } from '../../core'; |
6 | import { SortField, Video, VideoService } from '../shared'; | 6 | import { SortField, Video, VideoService } from '../shared'; |
7 | import { User } from '../../shared'; | 7 | import { User } from '../../shared'; |
8 | 8 | ||
@@ -24,6 +24,7 @@ export class VideoMiniatureComponent { | |||
24 | constructor( | 24 | constructor( |
25 | private notificationsService: NotificationsService, | 25 | private notificationsService: NotificationsService, |
26 | private confirmService: ConfirmService, | 26 | private confirmService: ConfirmService, |
27 | private configService: ConfigService, | ||
27 | private videoService: VideoService | 28 | private videoService: VideoService |
28 | ) {} | 29 | ) {} |
29 | 30 | ||
@@ -31,6 +32,13 @@ export class VideoMiniatureComponent { | |||
31 | return this.hovering && this.video.isRemovableBy(this.user); | 32 | return this.hovering && this.video.isRemovableBy(this.user); |
32 | } | 33 | } |
33 | 34 | ||
35 | getVideoName() { | ||
36 | if (this.isVideoNSFWForThisUser()) | ||
37 | return 'NSFW'; | ||
38 | |||
39 | return this.video.name; | ||
40 | } | ||
41 | |||
34 | onBlur() { | 42 | onBlur() { |
35 | this.hovering = false; | 43 | this.hovering = false; |
36 | } | 44 | } |
@@ -52,4 +60,8 @@ export class VideoMiniatureComponent { | |||
52 | } | 60 | } |
53 | ); | 61 | ); |
54 | } | 62 | } |
63 | |||
64 | isVideoNSFWForThisUser() { | ||
65 | return this.video.isVideoNSFWForUser(this.user); | ||
66 | } | ||
55 | } | 67 | } |