-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- move reactions part to a separate template - add translation capabilities to this template. Create new templates for reactions templates - handles url for unauthenticated users. - like and dislike icon moved to a separate template. Remove Reaction manager - it wasn't used anywhere in the application. Change request method for reaction - GET allows redirect for unauthenticated users - make the corresponding change to the javascript function Changes in tests - add tests in models for post delete signal. - refactor code for view tests. - remove unnecessary part.
- Loading branch information
1 parent
e9913da
commit 0aee068
Showing
12 changed files
with
111 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
# flake8: noqa | ||
from comment.manager.comments import * | ||
from comment.manager.reactions import * | ||
from comment.manager.comments import * |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{% load comment_tags %} | ||
{% block dislike_img_icon %} | ||
<svg class="comment-reaction-icon reaction-dislike" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill={% if comment|add_one_arg:user|has_reacted:"dislike" %}"#ffc966"{% else %}"none"{% endif %} stroke="#427297" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"> | ||
<path d="M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3"></path> | ||
</svg> | ||
{% endblock dislike_img_icon %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{% load comment_tags %} | ||
{% block like_img_icon %} | ||
<svg class="comment-reaction-icon reaction-like" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill={% if comment|add_one_arg:user|has_reacted:"like" %}"#ffc966"{% else %}"none"{% endif %} stroke="#427297" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"> | ||
<path d="M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3"></path> | ||
</svg> | ||
{% endblock like_img_icon %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{% load i18n %} | ||
<div class="js-comment-reactions mt-2"> | ||
<span class="js-like-number text-dark">{{ comment.likes }}</span> | ||
{% url 'comment:react' comment_id=comment.id reaction='like' as like_url %} | ||
<a title="{% trans "like" %}" class="{% block like_link_cls %} {% endblock like_link_cls %} | ||
{% if user.is_authenticated %} | ||
js-comment-reaction" href="{{ like_url }}" data-csrf="{{ csrf_token }}" | ||
{% else %} | ||
" href="{{ login_url }}/?next={{ like_url }}" | ||
{% endif %} | ||
> | ||
{% include "comment/like_icon.html" %} | ||
</a> | ||
<span class="ml-4 js-dislike-number text-dark">{{ comment.dislikes }}</span> | ||
{% url 'comment:react' comment_id=comment.id reaction='dislike' as dislike_url %} | ||
<a title="{% trans "dislike" %}" class="{% block dislike_link_cls %} {% endblock dislike_link_cls %} | ||
{% if user.is_authenticated %} | ||
js-comment-reaction" href="{{ dislike_url }}" data-csrf="{{ csrf_token }}" | ||
{% else %} | ||
" href="{{ login_url }}/?next={{ dislike_url }}" | ||
{% endif %} | ||
> | ||
{% include "comment/dislike_icon.html" %} | ||
</a> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters