mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 21:34:25 +00:00
Merge branch '327_pinned_comment' into notification/completion
This commit is contained in:
commit
bdf4b71080
@ -16,6 +16,7 @@ use Chill\PersonBundle\Form\AccompanyingCourseCommentType;
|
|||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||||
use Symfony\Component\Form\FormInterface;
|
use Symfony\Component\Form\FormInterface;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
@ -27,7 +28,7 @@ use function array_key_exists;
|
|||||||
class AccompanyingCourseCommentController extends AbstractController
|
class AccompanyingCourseCommentController extends AbstractController
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Comments page of Accompanying Course section.
|
* Page of comments in Accompanying Course section.
|
||||||
*
|
*
|
||||||
* @Route("/{_locale}/parcours/{accompanying_period_id}/comments", name="chill_person_accompanying_period_comment_list")
|
* @Route("/{_locale}/parcours/{accompanying_period_id}/comments", name="chill_person_accompanying_period_comment_list")
|
||||||
* @ParamConverter("accompanyingCourse", options={"id": "accompanying_period_id"})
|
* @ParamConverter("accompanyingCourse", options={"id": "accompanying_period_id"})
|
||||||
@ -55,9 +56,10 @@ class AccompanyingCourseCommentController extends AbstractController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null === $editForm) {
|
dump($editForm);
|
||||||
throw new NotFoundHttpException('Unable to find an edit form.');
|
//if (null === $editForm) {
|
||||||
}
|
// throw new NotFoundHttpException('Unable to find an edit form.');
|
||||||
|
//}
|
||||||
|
|
||||||
if ($request->getMethod() === Request::METHOD_POST) {
|
if ($request->getMethod() === Request::METHOD_POST) {
|
||||||
$currentForm = $editForm->handleRequest($request);
|
$currentForm = $editForm->handleRequest($request);
|
||||||
@ -82,7 +84,7 @@ class AccompanyingCourseCommentController extends AbstractController
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->render('@ChillPerson/AccompanyingCourse/comment_list.html.twig', [
|
return $this->render('@ChillPerson/AccompanyingCourse/Comment/index.html.twig', [
|
||||||
'accompanyingCourse' => $accompanyingCourse,
|
'accompanyingCourse' => $accompanyingCourse,
|
||||||
'form' => $form->createView(),
|
'form' => $form->createView(),
|
||||||
'edit_form' => null !== $editForm ? $editForm->createView() : null,
|
'edit_form' => null !== $editForm ? $editForm->createView() : null,
|
||||||
@ -100,4 +102,40 @@ class AccompanyingCourseCommentController extends AbstractController
|
|||||||
|
|
||||||
return $form;
|
return $form;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////// building
|
||||||
|
///
|
||||||
|
// /**
|
||||||
|
// * Delete an existing comment
|
||||||
|
// *
|
||||||
|
// * @Route(
|
||||||
|
// * "/{_locale}/parcours/{accompanying_period_id}/comment/{comment_id}/delete",
|
||||||
|
// * name="chill_person_accompanying_period_comment_delete"
|
||||||
|
// * )
|
||||||
|
// * @ParamConverter("accompanyingCourse", options={"id": "accompanying_period_id"})
|
||||||
|
// * @ParamConverter("comment", options={"id": "comment_id"})
|
||||||
|
// */
|
||||||
|
// public function deleteAction(AccompanyingPeriod $accompanyingCourse, AccompanyingPeriod\Comment $comment, Request $request)
|
||||||
|
// {
|
||||||
|
// $form = $this->createDeleteForm($comment->getId(), $accompanyingCourse);
|
||||||
|
//
|
||||||
|
// return $this->render('@ChillPerson/AccompanyingCourse/Comment/confirm_delete.html.twig', [
|
||||||
|
// 'comment' => $comment,
|
||||||
|
// 'delete_form' => $form->createView(),
|
||||||
|
// 'accompanyingCourse' => $accompanyingCourse,
|
||||||
|
// ]);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// private function createDeleteForm(int $id, ?AccompanyingPeriod $accompanyingCourse): FormInterface
|
||||||
|
// {
|
||||||
|
// $form = $this->createForm($type);
|
||||||
|
//
|
||||||
|
// return $this->createFormBuilder()
|
||||||
|
// ->setAction($this->generateUrl('chill_person_accompanying_period_comment_delete', $params))
|
||||||
|
// ->setMethod('DELETE')
|
||||||
|
// ->add('submit', SubmitType::class, ['label' => 'Delete'])
|
||||||
|
// ->getForm();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//// end
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
{# WIP
|
||||||
|
|
||||||
|
{% extends "@ChillPerson/Person/layout.html.twig" %}
|
||||||
|
|
||||||
|
{% set person = activity.person %}
|
||||||
|
|
||||||
|
{% block title 'Remove comment'|trans %}
|
||||||
|
|
||||||
|
{% block personcontent %}
|
||||||
|
{{ include('@ChillMain/Util/confirmation_template.html.twig',
|
||||||
|
{
|
||||||
|
'title' : 'Remove comment'|trans,
|
||||||
|
'confirm_question' : 'Are you sure you want to remove comment ?'|trans,
|
||||||
|
'cancel_route' : 'chill_activity_activity_list',
|
||||||
|
'cancel_parameters' : { 'person_id' : activity.person.id, 'id' : activity.id },
|
||||||
|
'form' : delete_form
|
||||||
|
} ) }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
#}
|
@ -4,42 +4,7 @@
|
|||||||
{{ 'Accompanying Course Comment list'|trans }}
|
{{ 'Accompanying Course Comment list'|trans }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% macro show_comment(comment, options) %}
|
{% import '@ChillPerson/AccompanyingCourse/Comment/macro_showItem.html.twig' as macro %}
|
||||||
<div class="item-bloc">
|
|
||||||
<div class="item-row">
|
|
||||||
<div>
|
|
||||||
{% if options.pinned is defined %}
|
|
||||||
<i class="fa fa-flag fa-fw fa-lg" title="{{ 'pinned'|trans }}"></i>
|
|
||||||
{% endif %}
|
|
||||||
<a id="comment{{ comment.id }}" href="{{ '#comment' ~ comment.id }}" class="fa fa-pencil-square-o fa-fw"></a>
|
|
||||||
{{ 'by'|trans }}<b>{{ comment.creator }}</b>{{ ', ' ~ 'on'|trans ~ ' ' ~ comment.createdAt|format_date('long') }}<br>
|
|
||||||
<i>{{ 'Last updated on'|trans ~ ' ' ~ comment.updatedAt|format_datetime('long', 'short') }}</i>
|
|
||||||
</div>
|
|
||||||
<ul class="record_actions">
|
|
||||||
{% if options.pinned is not defined %}
|
|
||||||
<li>
|
|
||||||
<button class="btn btn-sm btn-misc" type="button">
|
|
||||||
<i class="fa fa-flag fa-fw"></i>
|
|
||||||
Épingler
|
|
||||||
</button>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
<li>
|
|
||||||
<a class="btn btn-sm btn-edit" title="{{ 'Edit'|trans }}" href="{{ path('chill_person_accompanying_period_comment_list', {
|
|
||||||
'accompanying_period_id': comment.accompanyingPeriod.id,
|
|
||||||
'edit': comment.id
|
|
||||||
}) ~ '#comment' ~ comment.id }}"></a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a class="btn btn-sm btn-delete" title="{{ 'Delete'|trans }}" href=""></a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="item-row separator">
|
|
||||||
<blockquote class="chill-user-quote col">{{ comment.content|chill_markdown_to_html }}</blockquote>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endmacro %}
|
|
||||||
|
|
||||||
{% macro form_comment(type, form) %}
|
{% macro form_comment(type, form) %}
|
||||||
{% if type == 'edit' %}
|
{% if type == 'edit' %}
|
||||||
@ -73,14 +38,14 @@
|
|||||||
{% if commentEditId == accompanyingCourse.pinnedComment.id %}
|
{% if commentEditId == accompanyingCourse.pinnedComment.id %}
|
||||||
{{ _self.form_comment('edit', edit_form) }}
|
{{ _self.form_comment('edit', edit_form) }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ _self.show_comment(accompanyingCourse.pinnedComment, {'pinned': 'true'}) }}
|
{{ macro.show_comment(accompanyingCourse.pinnedComment, {'pinned': 'true'}) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% for c in accompanyingCourse.comments %}
|
{% for c in accompanyingCourse.comments %}
|
||||||
{% if commentEditId == c.id %}
|
{% if commentEditId == c.id %}
|
||||||
{{ _self.form_comment('edit', edit_form) }}
|
{{ _self.form_comment('edit', edit_form) }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ _self.show_comment(c) }}
|
{{ macro.show_comment(c) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
@ -0,0 +1,36 @@
|
|||||||
|
{% macro show_comment(comment, options) %}
|
||||||
|
<div class="item-bloc">
|
||||||
|
<div class="item-row">
|
||||||
|
<div>
|
||||||
|
{% if options.pinned is defined %}
|
||||||
|
<i class="fa fa-flag fa-fw fa-lg" title="{{ 'pinned'|trans }}"></i>
|
||||||
|
{% endif %}
|
||||||
|
<a id="comment{{ comment.id }}" href="{{ '#comment' ~ comment.id }}" class="fa fa-pencil-square-o fa-fw"></a>
|
||||||
|
{{ 'by'|trans }}<b>{{ comment.creator }}</b>{{ ', ' ~ 'on'|trans ~ ' ' ~ comment.createdAt|format_date('long') }}<br>
|
||||||
|
<i>{{ 'Last updated on'|trans ~ ' ' ~ comment.updatedAt|format_datetime('long', 'short') }}</i>
|
||||||
|
</div>
|
||||||
|
<ul class="record_actions">
|
||||||
|
{% if options.pinned is not defined %}
|
||||||
|
<li>
|
||||||
|
<button class="btn btn-sm btn-misc" type="button">
|
||||||
|
<i class="fa fa-flag fa-fw"></i>
|
||||||
|
{{ 'Pin comment'|trans }}
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
<li>
|
||||||
|
<a class="btn btn-sm btn-edit" title="{{ 'Edit'|trans }}" href="{{ path('chill_person_accompanying_period_comment_list', {
|
||||||
|
'accompanying_period_id': comment.accompanyingPeriod.id,
|
||||||
|
'edit': comment.id
|
||||||
|
}) ~ '#comment' ~ comment.id }}"></a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a class="btn btn-sm btn-delete" title="{{ 'Delete'|trans }}" href=""></a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="item-row separator">
|
||||||
|
<blockquote class="chill-user-quote col">{{ comment.content|chill_markdown_to_html }}</blockquote>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endmacro %}
|
@ -413,6 +413,7 @@ fix it: Compléter
|
|||||||
Accompanying Course Comment: Commentaire
|
Accompanying Course Comment: Commentaire
|
||||||
Accompanying Course Comment list: Commentaires du parcours
|
Accompanying Course Comment list: Commentaires du parcours
|
||||||
pinned: épinglé
|
pinned: épinglé
|
||||||
|
Pin comment: Épingler
|
||||||
Post a new comment: Poster un nouveau commentaire
|
Post a new comment: Poster un nouveau commentaire
|
||||||
Write a new comment: Écrire un nouveau commentaire
|
Write a new comment: Écrire un nouveau commentaire
|
||||||
Edit a comment: Modifier le commentaire
|
Edit a comment: Modifier le commentaire
|
||||||
|
Loading…
x
Reference in New Issue
Block a user