update admin of comments

This commit is contained in:
Simon Vieille 2021-04-01 16:26:08 +02:00
parent 9a73b02f7b
commit b8d64f307f
4 changed files with 36 additions and 6 deletions

View File

@ -207,4 +207,17 @@ class Comment implements EntityInterface
{ {
return 'https://secure.gravatar.com/avatar/'.md5($this->getEmail()).'.jpg?s=90&d=retro'; return 'https://secure.gravatar.com/avatar/'.md5($this->getEmail()).'.jpg?s=90&d=retro';
} }
/**
* {@inheritdoc}
*/
public function __toString()
{
return sprintf(
'[%s] (%s) %s',
$this->getAuthor(),
$this->getCreatedAt()->format('d/m/Y'),
substr($this->getContent(), 0, 20).'…'
);
}
} }

View File

@ -106,7 +106,6 @@ class CommentType extends AbstractType
[ [
'label' => 'Réponse à', 'label' => 'Réponse à',
'class' => Comment::class, 'class' => Comment::class,
'choice_label' => 'author',
'required' => false, 'required' => false,
'multiple' => false, 'multiple' => false,
'attr' => [ 'attr' => [

View File

@ -42,7 +42,14 @@
{{ item.author }} {{ item.author }}
</a> </a>
Dans <a href="">{{ item.post.title }}</a> Dans <a href="{{ path('admin_blog_post_show', {entity: item.post.id}) }}">{{ item.post.title }}</a>
{% if item.parentComment %}
en réponse à
<a href="{{ path('admin_blog_comment_show', {entity: item.parentComment.id}) }}">
{{ item.parentComment }}
</a>
{% endif %}
</td> </td>
<td class="col-2"> <td class="col-2">
<span class="btn btn-sm btn-light"> <span class="btn btn-sm btn-light">

View File

@ -49,11 +49,22 @@
{{ entity.post.title }} {{ entity.post.title }}
</li> </li>
<li class="list-group-item"> {% if entity.parentComment %}
<span class="font-weight-bold pb-2 d-block">Réponse à</span> <li class="list-group-item">
<span class="font-weight-bold pb-2 d-block">
Réponse à
<a href="{{ path('admin_blog_comment_show', {entity: entity.parentComment.id}) }}">
{{ entity.parentComment.author }} - {{ entity.parentComment.createdAt|date('d/m/Y H:i') }}
</a>
</span>
{{ entity.parentComment ? entity.parentComment.author : '-' }} {% if entity.parentComment.createdAt.timestamp > 1538118768 %} {# 28/09/2018 #}
</li> {{- entity.parentComment.content|markdown('comment') -}}
{% else %}
{{- entity.parentComment.content|comment -}}
{% endif %}
</li>
{% endif %}
<li class="list-group-item"> <li class="list-group-item">
<span class="font-weight-bold pb-2 d-block">Status</span> <span class="font-weight-bold pb-2 d-block">Status</span>