diff --git a/app/routes/clinics.js b/app/routes/clinics.js index 552b232..e61ef55 100644 --- a/app/routes/clinics.js +++ b/app/routes/clinics.js @@ -141,8 +141,13 @@ module.exports = router => { // Save back to session req.session.data = data; - // Redirect back to the same filter view - res.redirect(`/clinics/${clinicId}/${currentFilter}`); + // If there's a returnTo path, use that, otherwise go back to the filter view + const returnTo = req.query.returnTo; + if (returnTo) { + res.redirect(returnTo); + } else { + res.redirect(`/clinics/${clinicId}/${currentFilter}`); + } }); function filterEvents(events, filter) { diff --git a/app/views/participants/show.html b/app/views/participants/show.html index c11b823..fa9c93a 100644 --- a/app/views/participants/show.html +++ b/app/views/participants/show.html @@ -7,8 +7,8 @@ {% set back = { - href: "/clinics", - text: "Clinics" + href: "/clinics/" + clinicId, + text: "Back to clinic" } %} {% block pageContent %} @@ -39,7 +39,10 @@