pyfedi/app/templates/post/_comment_voting_buttons.html

26 lines
2 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 {{ 'voted_up' if in_sorted_list(recently_upvoted_replies, comment.id) }}" role="button" aria-label="{{ _('UpVote button.') }}" aria-live="assertive"
2024-01-19 22:49:16 +13:00
hx-post="/comment/{{ comment.id }}/upvote" hx-trigger="click throttle:1s" hx-target="closest .voting_buttons_new" tabindex="0">
2024-01-17 19:00:39 +13:00
<span class="fe fe-arrow-up"></span>
<img class="htmx-indicator" src="/static/images/spinner.svg" alt="" style="opacity: 0;">
</div>
{% endif %}
2024-02-26 21:26:19 +13:00
<span title="{{ comment.up_votes }}, {{ comment.down_votes }}" aria-live="assertive" aria-label="{{ _('Score: ') }}{{ comment.up_votes - comment.down_votes }}.">{{ comment.up_votes - comment.down_votes }}</span>
{% if can_downvote(current_user, community) %}
<div class="downvote_button {{ 'voted_down' if in_sorted_list(recently_downvoted_replies, comment.id) }}" role="button" aria-label="{{ _('DownVote button.') }}" aria-live="assertive"
2024-01-19 22:49:16 +13:00
hx-post="/comment/{{ comment.id }}/downvote" hx-trigger="click throttle:1s" hx-target="closest .voting_buttons_new" tabindex="0">
2024-01-17 19:00:39 +13:00
<span class="fe fe-arrow-down"></span>
<img class="htmx-indicator" src="/static/images/spinner.svg" alt="" style="opacity: 0;">
</div>
{% endif %}
2023-10-23 13:03:35 +13:00
{% else %}
2024-01-21 12:35:20 +13:00
<div class="upvote_button digits_{{ digits(comment.up_votes) }} {{ upvoted_class }} redirect_login">
2023-10-23 13:03:35 +13:00
<span class="fe fe-arrow-up"></span>
</div>
2024-02-26 21:26:19 +13:00
<span title="{{ comment.up_votes }}, {{ comment.down_votes }}" aria-live="assertive" aria-label="{{ _('Score:') }}">{{ comment.up_votes - comment.down_votes }}</span>
2024-01-21 12:35:20 +13:00
<div class="downvote_button digits_{{ digits(comment.down_votes) }} {{ downvoted_class }} redirect_login">
2023-10-23 13:03:35 +13:00
<span class="fe fe-arrow-down"></span>
</div>
{% endif %}