46 lines
2.2 KiB
HTML
46 lines
2.2 KiB
HTML
{% macro paginate(pagination) %}
|
|
{% if pagination %}
|
|
{% if pagination.pages > 1 %}
|
|
{% if pagination.current > 1 %}
|
|
<a href="{{ pagination.url }}{{ pagination.current - 1 }}">Previous</a>
|
|
<b> | </b>
|
|
{% endif %}
|
|
Page {{ pagination.current }} of {{ pagination.pages }}
|
|
{% if pagination.current < pagination.pages %}
|
|
<b> | </b>
|
|
<a href="{{ pagination.url }}{{ pagination.current + 1}}">Next</a>
|
|
{% endif %}
|
|
{% endif %}
|
|
{% 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 %}
|
|
<div class="result-wrapper">
|
|
<a href="/{{ domain }}/videos/watch/{{ video.uuid }}">
|
|
<img src="{% if video.thumbnailPath.startswith("http") %}{{ video.thumbnailPath }}{% else %}https://{{ domain }}{{ video.thumbnailPath }}{% endif %}" height="150"/>
|
|
</a>
|
|
|
|
<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 #}
|
|
{{ date(video) }} - {{ video.views }} Views
|
|
<br>{% if video.channel %}
|
|
<a href="/{{ video.channel.host }}/video-channels/{{ video.channel.name }}">
|
|
<b>{{ video.channel.displayName }}</b>
|
|
</a>{% endif %}
|
|
<br>
|
|
<a href="/{{ video.account.host }}/accounts/{{ video.account.name }}">
|
|
{{ video.account.name }}@{{ video.account.host }}
|
|
</a>
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
{% endmacro %}
|