feat: return to detail view after editing accommodation booking
This commit is contained in:
@@ -135,7 +135,17 @@ class EditController extends AbstractController
|
||||
'groupName' => $booking->getGroupName(),
|
||||
]);
|
||||
|
||||
return $this->redirectToRoute('app_admin_accommodationbooking_edit', ['id' => $booking->getId()]);
|
||||
// Back to the detail page rather than the form: that is where every named status
|
||||
// action lives, so it is the view a manager needs after saving. The return url is
|
||||
// forwarded still encoded, the way return_url() handed it over, so that the detail
|
||||
// page's "zurück" leads to the filtered list the edit was started from.
|
||||
$parameters = ['id' => $booking->getId()];
|
||||
$returnUrl = $request->query->getString('r');
|
||||
if ('' !== $returnUrl) {
|
||||
$parameters['r'] = $returnUrl;
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('app_admin_accommodationbooking_show', $parameters);
|
||||
}
|
||||
|
||||
return $this->render('admin/accommodation_booking/edit.html.twig', [
|
||||
|
||||
@@ -69,7 +69,11 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex justify-between pt-8">
|
||||
<a href="{{ path('app_admin_accommodationbooking_show', { 'id': booking.id }) }}" class="button button--secondary button--small">
|
||||
{% set back_params = { 'id': booking.id } %}
|
||||
{% if app.request.query.get('r') %}
|
||||
{% set back_params = back_params | merge({ 'r': app.request.query.get('r') }) %}
|
||||
{% endif %}
|
||||
<a href="{{ path('app_admin_accommodationbooking_show', back_params) }}" class="button button--secondary button--small">
|
||||
zurück
|
||||
</a>
|
||||
<button type="submit" class="button button--primary button--small">
|
||||
|
||||
@@ -275,7 +275,11 @@
|
||||
PDF herunterladen
|
||||
</a>
|
||||
{% endif %}
|
||||
<a href="{{ path('app_admin_accommodationbooking_edit', { 'id': booking.id }) }}" class="button button--primary button--small">
|
||||
{% set edit_params = { 'id': booking.id } %}
|
||||
{% if app.request.query.get('r') %}
|
||||
{% set edit_params = edit_params | merge({ 'r': app.request.query.get('r') }) %}
|
||||
{% endif %}
|
||||
<a href="{{ path('app_admin_accommodationbooking_edit', edit_params) }}" class="button button--primary button--small">
|
||||
bearbeiten
|
||||
</a>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user