mirror of https://github.com/Chocobozzz/PeerTube
Client: add views information and sort
parent
f282639b07
commit
05a9feaa48
|
@ -11,6 +11,7 @@ export class Video {
|
||||||
podHost: string;
|
podHost: string;
|
||||||
tags: string[];
|
tags: string[];
|
||||||
thumbnailPath: string;
|
thumbnailPath: string;
|
||||||
|
views: number;
|
||||||
|
|
||||||
private static createByString(author: string, podHost: string) {
|
private static createByString(author: string, podHost: string) {
|
||||||
return author + '@' + podHost;
|
return author + '@' + podHost;
|
||||||
|
@ -36,7 +37,8 @@ export class Video {
|
||||||
name: string,
|
name: string,
|
||||||
podHost: string,
|
podHost: string,
|
||||||
tags: string[],
|
tags: string[],
|
||||||
thumbnailPath: string
|
thumbnailPath: string,
|
||||||
|
views: number
|
||||||
}) {
|
}) {
|
||||||
this.author = hash.author;
|
this.author = hash.author;
|
||||||
this.createdAt = new Date(hash.createdAt);
|
this.createdAt = new Date(hash.createdAt);
|
||||||
|
@ -49,6 +51,7 @@ export class Video {
|
||||||
this.podHost = hash.podHost;
|
this.podHost = hash.podHost;
|
||||||
this.tags = hash.tags;
|
this.tags = hash.tags;
|
||||||
this.thumbnailPath = hash.thumbnailPath;
|
this.thumbnailPath = hash.thumbnailPath;
|
||||||
|
this.views = hash.views;
|
||||||
|
|
||||||
this.by = Video.createByString(hash.author, hash.podHost);
|
this.by = Video.createByString(hash.author, hash.podHost);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,9 @@
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<a [routerLink]="['/videos/list', { field: 'author', search: video.author, sort: currentSort }]" class="video-miniature-author">{{ video.by }}</a>
|
<a [routerLink]="['/videos/list', { field: 'author', search: video.author, sort: currentSort }]" class="video-miniature-author">{{ video.by }}</a>
|
||||||
|
<span class="video-miniature-views-created-at">
|
||||||
|
<span class="video-miniature-views">{{ video.views }} views</span>
|
||||||
<span class="video-miniature-created-at">{{ video.createdAt | date:'short' }}</span>
|
<span class="video-miniature-created-at">{{ video.createdAt | date:'short' }}</span>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -79,12 +79,17 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.video-miniature-author, .video-miniature-created-at {
|
.video-miniature-author, .video-miniature-views-created-at {
|
||||||
display: block;
|
display: block;
|
||||||
margin-left: 1px;
|
margin-left: 1px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: #337ab7;
|
color: #337ab7;
|
||||||
opacity: 0.9;
|
opacity: 0.9;
|
||||||
|
|
||||||
|
.video-miniature-created-at::before {
|
||||||
|
content: '\002022';
|
||||||
|
margin: 0 2px 0 1px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.video-miniature-author {
|
.video-miniature-author {
|
||||||
|
|
|
@ -18,7 +18,9 @@ export class VideoSortComponent {
|
||||||
'duration': 'Duration - Asc',
|
'duration': 'Duration - Asc',
|
||||||
'-duration': 'Duration - Desc',
|
'-duration': 'Duration - Desc',
|
||||||
'createdAt': 'Created Date - Asc',
|
'createdAt': 'Created Date - Asc',
|
||||||
'-createdAt': 'Created Date - Desc'
|
'-createdAt': 'Created Date - Desc',
|
||||||
|
'views': 'Views - Asc',
|
||||||
|
'-views': 'Views - Desc'
|
||||||
};
|
};
|
||||||
|
|
||||||
get choiceKeys() {
|
get choiceKeys() {
|
||||||
|
|
|
@ -57,17 +57,20 @@
|
||||||
<span class="glyphicon glyphicon-share"></span> Share
|
<span class="glyphicon glyphicon-share"></span> Share
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button title="Get magnet URI" id="magnet-uri" class="btn btn-default" (click)="showMagnetUriModal()">
|
<div class="btn-group" dropdown>
|
||||||
<span class="glyphicon glyphicon-magnet"></span> Magnet
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<div *ngIf="isUserLoggedIn()" class="btn-group" dropdown>
|
|
||||||
<button id="single-button" type="button" id="more" class="btn btn-default" dropdownToggle>
|
<button id="single-button" type="button" id="more" class="btn btn-default" dropdownToggle>
|
||||||
<span class="glyphicon glyphicon-option-horizontal"></span> More
|
<span class="glyphicon glyphicon-option-horizontal"></span> More
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<ul dropdownMenu id="more-menu" role="menu" aria-labelledby="single-button">
|
<ul dropdownMenu id="more-menu" role="menu" aria-labelledby="single-button">
|
||||||
<li role="menuitem">
|
<li role="menuitem">
|
||||||
<a class="dropdown-item" href="#" (click)="showReportModal($event)">
|
<a class="dropdown-item" title="Get magnet URI" href="#" (click)="showMagnetUriModal($event)">
|
||||||
|
<span class="glyphicon glyphicon-magnet"></span> Magnet
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li *ngIf="isUserLoggedIn()" role="menuitem">
|
||||||
|
<a class="dropdown-item" title="Report this video" href="#" (click)="showReportModal($event)">
|
||||||
<span class="glyphicon glyphicon-alert"></span> Report
|
<span class="glyphicon glyphicon-alert"></span> Report
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
@ -76,12 +79,16 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="video-tags" class="row">
|
<div id="video-tags-views" class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-8">
|
||||||
<a *ngFor="let tag of video.tags" [routerLink]="['/videos/list', { field: 'tags', search: tag }]" class="label label-primary">
|
<a *ngFor="let tag of video.tags" [routerLink]="['/videos/list', { field: 'tags', search: tag }]" class="label label-primary">
|
||||||
{{ tag }}
|
{{ tag }}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="video-views" class="col-md-4 text-right">
|
||||||
|
{{ video.views }} views
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="video-description" class="row">
|
<div id="video-description" class="row">
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
top: 2px;
|
top: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#magnet-uri, #share, #more {
|
#share, #more {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
opacity: 0.85;
|
opacity: 0.85;
|
||||||
}
|
}
|
||||||
|
@ -71,12 +71,16 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#video-tags {
|
#video-tags-views {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
|
|
||||||
a {
|
a {
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#video-views {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#video-description {
|
#video-description {
|
||||||
|
|
|
@ -145,7 +145,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
|
||||||
this.videoShareModal.show();
|
this.videoShareModal.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
showMagnetUriModal() {
|
showMagnetUriModal(event: Event) {
|
||||||
|
event.preventDefault();
|
||||||
this.videoMagnetModal.show();
|
this.videoMagnetModal.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue