From a9b7ba78b58541559e13cd8a908e5998eda57015 Mon Sep 17 00:00:00 2001 From: Mahmoud Hamdy Date: Tue, 12 May 2026 06:13:38 +0300 Subject: [PATCH] Add "Go to Hadith Number" input to collection navigation Adds a numeric input plus "Go" button that lets users jump directly to a hadith by its number within the current collection. The widget is rendered on the collection landing page and on the book/single-hadith pages (collection/index.php and collection/dispbook.php). Input is restricted to numeric values via input attributes and a client-side regex check; the URL is built in JavaScript using the existing `:` route, so no new server-side handling is needed. Styling uses the same CSS variables as the search box widget, so the field picks up the existing light/dark themes. Fixes #153 --- .../front/views/collection/_go_to_hadith.php | 115 ++++++++++++++++++ .../front/views/collection/dispbook.php | 1 + .../modules/front/views/collection/index.php | 1 + 3 files changed, 117 insertions(+) create mode 100644 application/modules/front/views/collection/_go_to_hadith.php diff --git a/application/modules/front/views/collection/_go_to_hadith.php b/application/modules/front/views/collection/_go_to_hadith.php new file mode 100644 index 00000000..2fe3468d --- /dev/null +++ b/application/modules/front/views/collection/_go_to_hadith.php @@ -0,0 +1,115 @@ +:` route defined in application/config/main.php. + * + * @var string $collectionName The collection slug (e.g. "bukhari", "muslim"). + */ + +$inputId = 'goToHadithInput_' . uniqid(); +$formId = 'goToHadithForm_' . uniqid(); +$collectionNameJs = json_encode($collectionName, JSON_UNESCAPED_SLASHES); +?> +
+ +
+ + + + diff --git a/application/modules/front/views/collection/dispbook.php b/application/modules/front/views/collection/dispbook.php index 37edcf16..25c13abc 100644 --- a/application/modules/front/views/collection/dispbook.php +++ b/application/modules/front/views/collection/dispbook.php @@ -98,6 +98,7 @@ function displayBab($chapter, $collection, $ourBookID, $showIntro = true) {
+ render('/collection/_go_to_hadith', array('collectionName' => $collection->name)); ?> + render('/collection/_go_to_hadith', array('collectionName' => $collectionName)); ?>