Co-authored-by: Matis MAZINGUE <Matis.MAZINGUE@etu.uca.fr>
Co-authored-by: clfreville2 <clement.freville2@etu.uca.fr>
Reviewed-on: https://codefirst.iut.uca.fr/git/clement.freville2/herbarium/pulls/19
Co-authored-by: Matis MAZINGUE <matis.mazingue@etu.uca.fr>
Co-committed-by: Matis MAZINGUE <matis.mazingue@etu.uca.fr>
This commit is contained in:
Matis MAZINGUE
2024-06-14 09:41:05 +02:00
committed by Clément FRÉVILLE
parent beca5f92da
commit b0507a44ea
7 changed files with 147 additions and 1 deletions

View File

@@ -6,6 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
{% block stylesheets %}
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<link rel="stylesheet" href="{{ asset('css/app.css') }}">
{% endblock %}
{% block javascripts %}

View File

@@ -12,10 +12,25 @@
<p class="card-text">{{ post.commentary }}</p>
</div>
<div class="card-footer">
28 ❤️
<span class="likes-count">{{ post.likes.count() }}</span>
{% if app.user %}
<button class="like-toggle btn no-style {% if post.likes.contains(app.user) %}liked{% else %}not-liked{% endif %}"
data-post-id="{{ post.id }}"
data-like-url="{{ path('app_posts_like', {id: post.id}) }}"
data-unlike-url="{{ path('app_posts_unlike', {id: post.id}) }}">
{% if post.likes.contains(app.user) %}❤️{% else %}{% endif %}
</button>
{% else %}
<span class="like-toggle no-style not-liked">♡</span>
{% endif %}
{{ post.comments.count() }} 💬
</div>
</div>
{% endfor %}
{% include '_pagination.html.twig' %}
{% endblock %}
{% block javascripts %}
{{ parent() }}
<script src="{{ asset('js/like_toggle.js') }}"></script>
{% endblock %}