mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 05:44:24 +00:00
unpin comment is possible + delete and edit by all users that can edit period
This commit is contained in:
parent
83dd8f810c
commit
09503768f5
@ -84,7 +84,7 @@ class AccompanyingCourseCommentController extends AbstractController
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isset($commentEdited)) {
|
if (isset($commentEdited)) {
|
||||||
$this->denyAccessUnlessGranted(AccompanyingPeriodCommentVoter::EDIT, $commentEdited);
|
$this->denyAccessUnlessGranted(AccompanyingPeriodVoter::EDIT, $commentEdited->getAccompanyingPeriod());
|
||||||
} else {
|
} else {
|
||||||
throw new LogicException('at this step, commentEdited should be set');
|
throw new LogicException('at this step, commentEdited should be set');
|
||||||
}
|
}
|
||||||
@ -135,7 +135,7 @@ class AccompanyingCourseCommentController extends AbstractController
|
|||||||
*/
|
*/
|
||||||
public function deleteAction(AccompanyingPeriod\Comment $comment, Request $request): Response
|
public function deleteAction(AccompanyingPeriod\Comment $comment, Request $request): Response
|
||||||
{
|
{
|
||||||
$this->denyAccessUnlessGranted(AccompanyingPeriodCommentVoter::DELETE, $comment);
|
$this->denyAccessUnlessGranted(AccompanyingPeriodVoter::EDIT, $comment->getAccompanyingPeriod());
|
||||||
|
|
||||||
$form = $this->createForm(FormType::class, []);
|
$form = $this->createForm(FormType::class, []);
|
||||||
$form->add('submit', SubmitType::class, ['label' => 'Confirm']);
|
$form->add('submit', SubmitType::class, ['label' => 'Confirm']);
|
||||||
@ -186,6 +186,24 @@ class AccompanyingCourseCommentController extends AbstractController
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Route("/{_locale}/parcours/comment/{id}/unpin", name="chill_person_accompanying_period_comment_unpin")
|
||||||
|
*/
|
||||||
|
public function unpinComment(AccompanyingPeriod\Comment $comment): Response
|
||||||
|
{
|
||||||
|
$this->denyAccessUnlessGranted(AccompanyingPeriodVoter::EDIT, $comment->getAccompanyingPeriod());
|
||||||
|
|
||||||
|
$comment->getAccompanyingPeriod()->setPinnedComment(null);
|
||||||
|
|
||||||
|
$this->getDoctrine()->getManager()->flush();
|
||||||
|
|
||||||
|
$this->addFlash('success', $this->translator->trans('accompanying_course.comment is unpinned'));
|
||||||
|
|
||||||
|
return $this->redirectToRoute('chill_person_accompanying_period_comment_list', [
|
||||||
|
'accompanying_period_id' => $comment->getAccompanyingPeriod()->getId(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
private function createCommentForm(AccompanyingPeriod\Comment $comment, string $step): FormInterface
|
private function createCommentForm(AccompanyingPeriod\Comment $comment, string $step): FormInterface
|
||||||
{
|
{
|
||||||
return $this->formFactory->createNamed($step, AccompanyingCourseCommentType::class, $comment);
|
return $this->formFactory->createNamed($step, AccompanyingCourseCommentType::class, $comment);
|
||||||
|
@ -8,6 +8,17 @@
|
|||||||
|
|
||||||
{% macro recordAction(comment, isPinned) %}
|
{% macro recordAction(comment, isPinned) %}
|
||||||
{% if isPinned is defined and isPinned == true %}
|
{% if isPinned is defined and isPinned == true %}
|
||||||
|
<li>
|
||||||
|
<form method="post" action="{{ chill_path_forward_return_path('chill_person_accompanying_period_comment_unpin', {'id': comment.id}) }}">
|
||||||
|
<button class="btn btn-sm btn-misc" type="submit">
|
||||||
|
<span class="fa-stack">
|
||||||
|
<i class="fa fa-flag fa-stack-1x"></i>
|
||||||
|
<i class="fa fa-ban fa-stack-2x text-danger"></i>
|
||||||
|
</span>
|
||||||
|
{{ 'Unpin comment'|trans }}
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</li>
|
||||||
{% else %}
|
{% else %}
|
||||||
<li>
|
<li>
|
||||||
<form method="post" action="{{ chill_path_forward_return_path('chill_person_accompanying_period_comment_pin', {'id': comment.id}) }}">
|
<form method="post" action="{{ chill_path_forward_return_path('chill_person_accompanying_period_comment_pin', {'id': comment.id}) }}">
|
||||||
@ -17,7 +28,7 @@
|
|||||||
</form>
|
</form>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_COMMENT_EDIT', comment) %}
|
{% if is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_UPDATE', comment.accompanyingPeriod) %}
|
||||||
<li>
|
<li>
|
||||||
<a class="btn btn-sm btn-edit" title="{{ 'Edit'|trans }}" href="{{ path('chill_person_accompanying_period_comment_list', {
|
<a class="btn btn-sm btn-edit" title="{{ 'Edit'|trans }}" href="{{ path('chill_person_accompanying_period_comment_list', {
|
||||||
'_fragment': 'comment-' ~ comment.id,
|
'_fragment': 'comment-' ~ comment.id,
|
||||||
@ -26,7 +37,7 @@
|
|||||||
}) }}"></a>
|
}) }}"></a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_COMMENT_DELETE', comment) %}
|
{% if is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_UPDATE', comment.accompanyingPeriod) %}
|
||||||
<li>
|
<li>
|
||||||
<a class="btn btn-sm btn-delete" title="{{ 'Delete'|trans }}" href="{{ path('chill_person_accompanying_period_comment_delete', {'id': comment.id}) }}"></a>
|
<a class="btn btn-sm btn-delete" title="{{ 'Delete'|trans }}" href="{{ path('chill_person_accompanying_period_comment_delete', {'id': comment.id}) }}"></a>
|
||||||
</li>
|
</li>
|
||||||
|
@ -465,12 +465,14 @@ fix it: Compléter
|
|||||||
accompanying_course:
|
accompanying_course:
|
||||||
administrative_location: Localisation administrative
|
administrative_location: Localisation administrative
|
||||||
comment is pinned: Le commentaire est épinglé
|
comment is pinned: Le commentaire est épinglé
|
||||||
|
comment is unpinned: Le commentaire est désépinglé
|
||||||
|
|
||||||
# Accompanying Course comments
|
# Accompanying Course comments
|
||||||
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
|
Pin comment: Épingler
|
||||||
|
Unpin comment: Désé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