Fixed: [calendar doc] Add a return path to the calendar edit's form when the document has been generated

Fix https://gitlab.com/Chill-Projet/chill-bundles/-/issues/81
This commit is contained in:
Julien Fastré 2023-04-05 20:23:43 +02:00
parent 3df8ee6dc4
commit 1c19d01b60
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
2 changed files with 6 additions and 2 deletions

View File

@ -207,6 +207,7 @@ class CalendarController extends AbstractController
'entityClassName' => Calendar::class, 'entityClassName' => Calendar::class,
'entityId' => $entity->getId(), 'entityId' => $entity->getId(),
'template' => $template->getId(), 'template' => $template->getId(),
'returnPath' => $request->getRequestUri(),
]); ]);
} }
} }
@ -377,7 +378,9 @@ class CalendarController extends AbstractController
$this->addFlash('success', $this->translator->trans('Success : calendar item created!')); $this->addFlash('success', $this->translator->trans('Success : calendar item created!'));
if ($form->get('save_and_upload_doc')->isClicked()) { if ($form->get('save_and_upload_doc')->isClicked()) {
return $this->redirectToRoute('chill_calendar_calendardoc_new', ['id' => $entity->getId()]); return $this->redirectToRoute('chill_calendar_calendardoc_new', [
'id' => $entity->getId()
]);
} }
foreach ($templates as $template) { foreach ($templates as $template) {
@ -386,6 +389,7 @@ class CalendarController extends AbstractController
'entityClassName' => Calendar::class, 'entityClassName' => Calendar::class,
'entityId' => $entity->getId(), 'entityId' => $entity->getId(),
'template' => $template->getId(), 'template' => $template->getId(),
'returnPath' => $this->generateUrl('chill_calendar_calendar_edit', ['id' => $entity->getId()]),
]); ]);
} }
} }

View File

@ -28,7 +28,7 @@
<ul class="record_actions sticky-form-buttons"> <ul class="record_actions sticky-form-buttons">
<li class="cancel"> <li class="cancel">
<a class="btn btn-cancel" href="{{ chill_return_path_or('chill_calendar_calendar_list_by_accompanying_period', {'id': accompanyingCourse.id }) }}">{{ 'Cancel'|trans|chill_return_path_label }}</a> <a class="btn btn-cancel" href="{{ chill_return_path_or('chill_calendar_calendar_edit', {'id': calendar_doc.calendar.id }) }}">{{ 'Cancel'|trans|chill_return_path_label }}</a>
</li> </li>
<li> <li>