add pages vote

This commit is contained in:
Zhao-Linux 2022-11-16 22:43:03 +07:00
parent 3ee2f2afb0
commit d86f3d8f3e
10 changed files with 310 additions and 1 deletions

View file

@ -0,0 +1,22 @@
{% set logged_in = request.user.is_authenticated %}
{% set profile = request.profile if logged_in else None %}
<div class="page-vote">
<div class="page-vote-full" style="margin-right: 5px;">
{% if logged_in %}
<a href="javascript:pagevote_upvote({{ pagevote.id }})"
class="upvote-link fa fa-chevron-up fa-fw{% if pagevote.vote_score(request.profile) == 1 %} voted{% endif %}"></a>
{% else %}
<a href="javascript:alert('{{ _('Please log in to vote')|escapejs }}')" title="{{ _('Please log in to vote') }}"
class="upvote-link fa fa-chevron-up fa-fw"></a>
{% endif %}
<br>
<div class="pagevote-score"> {{ pagevote.score }} </div>
{% if logged_in %}
<a href="javascript:pagevote_downvote({{ pagevote.id }})"
class="downvote-link fa fa-chevron-down fa-fw{% if pagevote.vote_score(request.profile) == -1 %} voted{% endif %}"></a>
{% else %}
<a href="javascript:alert('{{ _('Please log in to vote')|escapejs }}')" title="{{ _('Please log in to vote') }}"
class="downvote-link fa fa-chevron-down fa-fw"></a>
{% endif %}
</div>
</div>