pyfedi/app/templates/post/_voting_buttons.html

28 lines
1.5 KiB
HTML
Raw Normal View History

2023-10-23 13:03:35 +13:00
{% if current_user.is_authenticated and current_user.verified %}
{% if can_upvote(current_user, community) %}
<div class="upvote_button digits_{{ digits(comment.up_votes) }} {{ upvoted_class }}"
hx-post="/comment/{{ comment.id }}/upvote" hx-trigger="click throttle:1s" hx-target="closest .voting_buttons">
<span class="fe fe-arrow-up"></span>
{{ comment.up_votes }}
<img class="htmx-indicator" src="/static/images/spinner.svg" alt="" style="opacity: 0;">
</div>
{% endif %}
{% if can_downvote(current_user, community) %}
<div class="downvote_button digits_{{ digits(comment.down_votes) }} {{ downvoted_class }}"
hx-post="/comment/{{ comment.id }}/downvote" hx-trigger="click throttle:1s" hx-target="closest .voting_buttons">
<span class="fe fe-arrow-down"></span>
{{ comment.down_votes }}
<img class="htmx-indicator" src="/static/images/spinner.svg" alt="" style="opacity: 0;">
</div>
{% endif %}
2023-10-23 13:03:35 +13:00
{% else %}
<div class="upvote_button digits_{{ digits(comment.up_votes) }} {{ upvoted_class }}">
<span class="fe fe-arrow-up"></span>
{{ comment.up_votes }}
</div>
<div class="downvote_button digits_{{ digits(comment.down_votes) }} {{ downvoted_class }}">
<span class="fe fe-arrow-down"></span>
{{ comment.down_votes }}
</div>
{% endif %}