pyfedi/app/templates/post/_post_voting_buttons.html

30 lines
2.3 KiB
HTML
Raw Normal View History

{% if current_user.is_authenticated and current_user.verified -%}
2025-01-10 15:19:42 -08:00
{% if (can_upvote_here or can_upvote(current_user, post.community)) and not disable_voting -%}
<div class="upvote_button {{ 'voted_up' if in_sorted_list(recently_upvoted, post.id) }}" role="button" aria-label="{{ _('UpVote button, %(count)d upvotes so far.', count=post.up_votes) }}" aria-live="assertive"
2024-09-05 01:10:26 -07:00
hx-post="/post/{{ post.id }}/upvote" hx-trigger="click throttle:1s" hx-target="closest .voting_buttons_new" tabindex="0">
<span class="fe fe-arrow-up"></span>
<img class="htmx-indicator" src="/static/images/spinner.svg" alt="" style="opacity: 0;">
</div>
{% endif -%}
2024-09-05 01:10:26 -07:00
<span title="{{ post.up_votes }}, {{ post.down_votes }}" aria-live="assertive" aria-label="{{ _('Score: ') }}{{ post.up_votes - post.down_votes }}.">{{ shorten_number(post.up_votes - post.down_votes) }}</span>
2025-01-10 15:19:42 -08:00
{%- if (can_downvote_here or can_downvote(current_user, post.community)) and not disable_voting -%}
<div class="downvote_button {{ 'voted_down' if in_sorted_list(recently_downvoted, post.id) }}" role="button" aria-label="{{ _('DownVote button, %(count)d downvotes so far.', count=post.down_votes) }}" aria-live="assertive"
2024-09-05 01:10:26 -07:00
hx-post="/post/{{ post.id }}/downvote" hx-trigger="click throttle:1s" hx-target="closest .voting_buttons_new" tabindex="0">
<span class="fe fe-arrow-down"></span>
<img class="htmx-indicator" src="/static/images/spinner.svg" alt="" style="opacity: 0;">
</div>
{%- endif -%}
{% else -%}
{% if not disable_voting -%}
<div class="upvote_button digits_{{ digits(post.up_votes) }} {{ upvoted_class }} redirect_login">
<span class="fe fe-arrow-up"></span>
</div>
{% endif -%}
<span title="{{ post.up_votes }}, {{ post.down_votes }}" aria-live="assertive" aria-label="{{ _('Score: ') }}{{ post.up_votes - post.down_votes }}.">{{ shorten_number(post.up_votes - post.down_votes) }}</span>
{%- if not disable_voting -%}
<div class="downvote_button digits_{{ digits(post.down_votes) }} {{ downvoted_class }} redirect_login">
<span class="fe fe-arrow-down"></span>
</div>
{%- endif -%}
{% endif -%}