From 73dd97f7d3ddc33ad31e1b37655b335ef32b123e Mon Sep 17 00:00:00 2001 From: nobohan Date: Fri, 18 Mar 2022 13:58:20 +0100 Subject: [PATCH 1/4] upd CHANGELOG --- CHANGELOG.md | 1 + .../ChillActivityBundle/Controller/ActivityController.php | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ff62b029c..17471fcdd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to ## Unreleased +* [activity] Add return path the document generation (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/553) * [person] AccompanyingPeriodWorkEvaluation: fix circular reference when serialising (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/495) * [person] order accompanying period by opening date in search persons, person and household period lists (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/493) * [parcours] autosave of the pinned comment for draft accompanying course (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/477) diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php index 3858979ef..6bf4f1d0d 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php @@ -220,6 +220,9 @@ final class ActivityController extends AbstractController $this->entityManager->persist($entity); $this->entityManager->flush(); + $params = $this->buildParamsToUrl($person, $accompanyingPeriod); + $params['id'] = $entity->getId(); + if ($form->has('gendocTemplateId') && null !== $form['gendocTemplateId']->getData()) { return $this->redirectToRoute( 'chill_docgenerator_generate_from_template', @@ -227,15 +230,13 @@ final class ActivityController extends AbstractController 'template' => $form->get('gendocTemplateId')->getData(), 'entityClassName' => Activity::class, 'entityId' => $entity->getId(), + 'returnPath' => $this->generateUrl('chill_activity_activity_edit', $params) ] ); } $this->addFlash('success', $this->get('translator')->trans('Success : activity updated!')); - $params = $this->buildParamsToUrl($person, $accompanyingPeriod); - $params['id'] = $entity->getId(); - return $this->redirectToRoute('chill_activity_activity_show', $params); } From 215b85972570dd89311e372654556d6796f82fae Mon Sep 17 00:00:00 2001 From: nobohan Date: Fri, 18 Mar 2022 15:25:45 +0100 Subject: [PATCH 2/4] activity: hide delete button from asyncupload and add delete buttons from chill collection --- src/Bundle/ChillActivityBundle/Form/ActivityType.php | 1 + .../Resources/public/page/edit_activity/index.scss | 5 +++++ .../views/Activity/editAccompanyingCourse.html.twig | 1 + src/Bundle/ChillActivityBundle/chill.webpack.config.js | 2 ++ 4 files changed, 9 insertions(+) create mode 100644 src/Bundle/ChillActivityBundle/Resources/public/page/edit_activity/index.scss diff --git a/src/Bundle/ChillActivityBundle/Form/ActivityType.php b/src/Bundle/ChillActivityBundle/Form/ActivityType.php index 6f935ad99..891eb8577 100644 --- a/src/Bundle/ChillActivityBundle/Form/ActivityType.php +++ b/src/Bundle/ChillActivityBundle/Form/ActivityType.php @@ -305,6 +305,7 @@ class ActivityType extends AbstractType 'label' => $activityType->getLabel('documents'), 'required' => $activityType->isRequired('documents'), 'allow_add' => true, + 'allow_delete' => true, 'button_add_label' => 'activity.Insert a document', 'button_remove_label' => 'activity.Remove a document', 'empty_collection_explain' => 'No documents', diff --git a/src/Bundle/ChillActivityBundle/Resources/public/page/edit_activity/index.scss b/src/Bundle/ChillActivityBundle/Resources/public/page/edit_activity/index.scss new file mode 100644 index 000000000..fc384742a --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Resources/public/page/edit_activity/index.scss @@ -0,0 +1,5 @@ +div.chill-dropzone__below-zone { + a.btn-delete { + display: none; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/editAccompanyingCourse.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/editAccompanyingCourse.html.twig index b278c0300..d0359e223 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/editAccompanyingCourse.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/editAccompanyingCourse.html.twig @@ -30,4 +30,5 @@ {{ parent() }} {{ encore_entry_link_tags('mod_async_upload') }} {{ encore_entry_link_tags('vue_activity') }} + {{ encore_entry_link_tags('page_edit_activity') }} {% endblock %} diff --git a/src/Bundle/ChillActivityBundle/chill.webpack.config.js b/src/Bundle/ChillActivityBundle/chill.webpack.config.js index f312e8a19..eec983920 100644 --- a/src/Bundle/ChillActivityBundle/chill.webpack.config.js +++ b/src/Bundle/ChillActivityBundle/chill.webpack.config.js @@ -7,5 +7,7 @@ module.exports = function(encore, entries) ChillActivityAssets: __dirname + '/Resources/public' }); + encore.addEntry('page_edit_activity', __dirname + '/Resources/public/page/edit_activity/index.scss'); + encore.addEntry('vue_activity', __dirname + '/Resources/public/vuejs/Activity/index.js'); }; From 9c353669ead5fd133f29f411353695790a012097 Mon Sep 17 00:00:00 2001 From: nobohan Date: Fri, 18 Mar 2022 16:11:09 +0100 Subject: [PATCH 3/4] activity: fix delete button for documents --- CHANGELOG.md | 1 + .../Resources/public/page/edit_activity/index.scss | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 17471fcdd..027eff683 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to ## Unreleased +* [activity] Fix delete button for document (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/554) * [activity] Add return path the document generation (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/553) * [person] AccompanyingPeriodWorkEvaluation: fix circular reference when serialising (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/495) * [person] order accompanying period by opening date in search persons, person and household period lists (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/493) diff --git a/src/Bundle/ChillActivityBundle/Resources/public/page/edit_activity/index.scss b/src/Bundle/ChillActivityBundle/Resources/public/page/edit_activity/index.scss index fc384742a..16e66eadb 100644 --- a/src/Bundle/ChillActivityBundle/Resources/public/page/edit_activity/index.scss +++ b/src/Bundle/ChillActivityBundle/Resources/public/page/edit_activity/index.scss @@ -2,4 +2,15 @@ div.chill-dropzone__below-zone { a.btn-delete { display: none; } -} \ No newline at end of file +} + +// do it in js does not work +// document.addEventListener('DOMContentLoaded', e => { +// const dropzoneBelow = document.querySelectorAll('div.chill-dropzone__below-zone'); +// dropzoneBelow.forEach( +// d => { +// const a = d.querySelector('a.btn-delete'); +// d.removeChild(a); +// } +// ) +// }); From 1f6565d2ef05a2379d234fcc226b061bc584387b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 21 Mar 2022 17:59:35 +0100 Subject: [PATCH 4/4] add return path when creating an activity --- .../ChillActivityBundle/Controller/ActivityController.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php index 6bf4f1d0d..97861ba67 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php @@ -179,14 +179,15 @@ final class ActivityController extends AbstractController { $view = null; - [$person, $accompanyingPeriod] = $this->getEntity($request); - $entity = $this->activityRepository->find($id); if (null === $entity) { throw $this->createNotFoundException('Unable to find Activity entity.'); } + $accompanyingPeriod = $entity->getAccompanyingPeriod(); + $person = $entity->getPerson(); + if ($entity->getAccompanyingPeriod() instanceof AccompanyingPeriod) { $view = 'ChillActivityBundle:Activity:editAccompanyingCourse.html.twig'; $accompanyingPeriod = $entity->getAccompanyingPeriod(); @@ -445,6 +446,9 @@ final class ActivityController extends AbstractController 'template' => $form->get('gendocTemplateId')->getData(), 'entityClassName' => Activity::class, 'entityId' => $entity->getId(), + 'returnPath' => $this->generateUrl('chill_activity_activity_edit', [ + 'id' => $entity->getId(), + ]) ] ); }