Also display date on single video page

This commit is contained in:
southerntofu 2021-08-04 21:17:35 +02:00
parent aedc4352ee
commit a09ed96eb6
2 changed files with 10 additions and 1 deletions

View File

@ -14,6 +14,11 @@
{% endif %}
{% endmacro %}
{# Extract the createdAt entry of the object and try to display it in a human-friendly manner #}
{%- macro date(object) -%}
<time datetime="{{ object.createdAt }}">{{ object.createdAt|truncate(10, true, "") }}</time>
{%- endmacro -%}
{% macro videos(videos, domain=None) %}
{% for video in videos %}
{% if domain == None %}{% set domain = video.account.host %}{% endif %}
@ -25,7 +30,7 @@
<div class="result-info">
<a href="/{{ video.account.host }}/videos/watch/{{ video.uuid }}">{{ video.name }}</a>
<br>{# For video lists, we don't have access to the VideoInfo struct (TODO: why not?), so this is just a quickhack based on peertube date format to extract relevant string out of it for human consumption #}
<time datetime="{{ video.createdAt }}">{{ video.createdAt|truncate(10, true, "") }}</time> - {{ video.views }} Views
{{ date(video) }} - {{ video.views }} Views
<br>{% if video.channel %}
<a href="/{{ video.channel.host }}/video-channels/{{ video.channel.name }}">
<b>{{ video.channel.displayName }}</b>

View File

@ -56,6 +56,10 @@ Views: <b>{{ video.views }}</b> Likes: <b>{{ video.likes }}</b> Dislikes: <b>{{
<br>
<table>
<tr>
<td><b>Date</b></td>
<td>{{ macros.date(video) }}</td>
</tr>
<tr>
<td><b>Category</b></td>
<td>{{ video.category.label }}</td>