From 0d72096d1931ec56a9b2677dc504ed6925e06b98 Mon Sep 17 00:00:00 2001 From: Samsh001 Date: Fri, 13 Dec 2024 14:23:14 +0000 Subject: [PATCH] store last search request for data publications in sessions and use for back to search results link(s) --- app/Http/Controllers/FrontendController.php | 3 +++ .../frontend/data-publication-detail-files.blade.php | 8 ++++++++ .../views/frontend/data-publication-detail.blade.php | 8 ++++++++ 3 files changed, 19 insertions(+) diff --git a/app/Http/Controllers/FrontendController.php b/app/Http/Controllers/FrontendController.php index cd5cdb3..72e08b6 100644 --- a/app/Http/Controllers/FrontendController.php +++ b/app/Http/Controllers/FrontendController.php @@ -137,6 +137,9 @@ public function dataPublications(Request $request) $result = $client->get($SearchRequest); + // store current url for linking back to search results from detail pages + $request->session()->put('data_publication_active_search', $request->fullUrl()); + if(!$result->isSuccess()) { abort(404, 'ckan request failed'); } diff --git a/resources/views/frontend/data-publication-detail-files.blade.php b/resources/views/frontend/data-publication-detail-files.blade.php index 1e9b2d8..83c8c05 100644 --- a/resources/views/frontend/data-publication-detail-files.blade.php +++ b/resources/views/frontend/data-publication-detail-files.blade.php @@ -9,6 +9,14 @@
+ @session('data_publication_active_search') + @include('components.tabLinks',[ + 'categoryName' => 'Results', + 'routes' => array( + 'Back to search results' => $value, + ) + ]) + @endsession @include('components.tabLinks',[ 'categoryName' => 'Sections', 'routes' => array( diff --git a/resources/views/frontend/data-publication-detail.blade.php b/resources/views/frontend/data-publication-detail.blade.php index bf0661c..ff82d0a 100644 --- a/resources/views/frontend/data-publication-detail.blade.php +++ b/resources/views/frontend/data-publication-detail.blade.php @@ -9,6 +9,14 @@
+ @session('data_publication_active_search') + @include('components.tabLinks',[ + 'categoryName' => 'Results', + 'routes' => array( + 'Back to search results' => $value, + ) + ]) + @endsession @include('components.tabLinks',[ 'categoryName' => 'Sections', 'routes' => array(