Implement comments

This commit is contained in:
2024-06-10 20:51:42 +02:00
parent b4a1ae592f
commit 67ff9ff8db
20 changed files with 479 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
{{ form_start(form) }}
{{ form_widget(form) }}
<button class="btn">{{ button_label|default('Save') }}</button>
<button class="btn btn-primary">{{ button_label|default('Save') }}</button>
{{ form_end(form) }}

View File

@@ -4,16 +4,16 @@
{% block body %}
{% for post in posts.iterator %}
<div class="card" style="width: 42rem; margin: 20px 0 50px 100px;">
<div class="card mb-4">
<div class="card-body">
<h5 class="card-title">{{ post.species ? post.species.vernacularName : 'Post' }}</h5>
<h5 class="card-title"><a href="{{ path('app_post_show', {id: post.id}) }}">{{ post.species ? post.species.vernacularName : 'Post' }}</a></h5>
<h6 class="card-subtitle mb-2 text-muted">{{ post.foundDate | date("d/m/Y \\à H \\h") }}</h6>
<p class="card-subtitle mb-2 text-muted">{{ post.latitude }}, {{ post.longitude }}, {{ post.altitude }}m</p>
<p class="card-text">{{ post.commentary }}</p>
</div>
<div class="card-footer">
28 ❤️
128 💬
{{ post.comments.count() }} 💬
</div>
</div>
{% endfor %}

View File

@@ -43,4 +43,17 @@
<a href="{{ path('app_post_edit', {'id': post.id}) }}">edit</a>
{{ include('post/_delete_form.html.twig') }}
<div data-turbo="true">
<div id="comments">
{% for comment in post.comments %}
{{ include('/comment/comment.html.twig') }}
{% endfor %}
</div>
{{ form_start(form) }}
{{ form_widget(form) }}
<button type="submit" class="btn btn-primary">Comment</button>
{{ form_end(form) }}
</div>
{% endblock %}