aurweb/templates/partials/packages/comments.html
moson-mo 2b8dedb3a2
feat: add pagination element below comments
other pages like the "package search" have this as well.

Issue report: #390

Signed-off-by: moson-mo <mo-son@mailbox.org>
2022-11-28 17:01:44 +01:00

56 lines
1.6 KiB
HTML

<!--
This partial requires the following to render properly
- pkgname
- pkgbase-id
- comments (list)
-->
{% if request.user.is_authenticated() %}
<div id="generic-form" class="box">
<h2>Add Comment</h2>
{% include "partials/packages/comment_form.html" %}
</div>
{% endif %}
{% if pinned_comments.count() %}
<div class="comments package-comments">
<div class="comments-header">
<h3>
<span class="text">{{ "Pinned Comments" | tr }}</span>
<span class="arrow"></span>
</h3>
</div>
{% for comment in pinned_comments.all() %}
{% include "partials/packages/comment.html" %}
{% endfor %}
</div>
{% endif %}
{% if comments.count() %}
<div class="comments package-comments">
<div class="comments-header">
<h3>
<span class="text">{{ "Latest Comments" | tr }}</span>
<span class="arrow"></span>
</h3>
{% set page = ((O / PP) | int) %}
{% set pages = ((comments_total / PP) | ceil) %}
{% if pages > 1 %}
<p class="comments-header-nav">
{{ page | pager_nav(comments_total, prefix) | safe }}
</p>
{% endif %}
</div>
{% for comment in comments.all() %}
{% include "partials/packages/comment.html" %}
{% endfor %}
<div class="comments-footer">
{% if pages > 1 %}
<p class="comments-footer-nav">
{{ page | pager_nav(comments_total, prefix) | safe }}
</p>
{% endif %}
</div>
</div>
{% endif %}