add blog vote
This commit is contained in:
parent
2a7a33fe1a
commit
c1cf8bc0e4
8 changed files with 242 additions and 7 deletions
|
@ -2,10 +2,12 @@
|
|||
|
||||
{% block js_media %}
|
||||
{% include "comments/media-js.html" %}
|
||||
{% include "blog/media-js.html" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block media %}
|
||||
{% include "comments/media-css.html" %}
|
||||
{% include "blog/media-css.html" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block title_row %}
|
||||
|
@ -15,8 +17,30 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<div class="post-full">
|
||||
<div class="post-title">{{ title }}</div>
|
||||
{% set logged_in = request.user.is_authenticated %}
|
||||
{% set profile = request.profile if logged_in else None %}
|
||||
<div class="post-full">
|
||||
<div style="display: flex;">
|
||||
<div class="blog-vote" style="margin-right: 5px;">
|
||||
{% if logged_in %}
|
||||
<a href="javascript:blog_upvote({{ post.id }})"
|
||||
class="upvote-link fa fa-chevron-up fa-fw{% if post.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="post-score"> {{ post.score }} </div>
|
||||
{% if logged_in %}
|
||||
<a href="javascript:blog_downvote({{ post.id }})"
|
||||
class="downvote-link fa fa-chevron-down fa-fw{% if post.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 class="post-title">{{ title }}</div>
|
||||
</div>
|
||||
<div class="time">
|
||||
{% with authors=post.authors.all() %}
|
||||
{% if authors %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue