Spaces:
Running
Running
souliya_pps commited on
Commit ·
cbb329e
1
Parent(s): 4a04c54
Add volume/page jump selector on E-Tipitaka detail page
Browse files
app/Controllers/EtipitakaController.php
CHANGED
|
@@ -123,6 +123,7 @@ class EtipitakaController {
|
|
| 123 |
$label = EtipitakaService::getLabel($code);
|
| 124 |
$prevPage = $page > 1 ? $page - 1 : null;
|
| 125 |
$nextPage = $page < $totalPages ? $page + 1 : null;
|
|
|
|
| 126 |
|
| 127 |
return view('pages.tipitaka.show', [
|
| 128 |
'content' => $content,
|
|
@@ -133,6 +134,7 @@ class EtipitakaController {
|
|
| 133 |
'prevPage' => $prevPage,
|
| 134 |
'nextPage' => $nextPage,
|
| 135 |
'totalPages' => $totalPages,
|
|
|
|
| 136 |
'seo' => [
|
| 137 |
'title' => 'E-Tipitaka - ເຫຼັ້ມທີ່ ' . $volume . ' ຫນ້າ ' . $page . ' (' . $label . ')',
|
| 138 |
'description' => 'ພຣະໄຕຣປິດກ ເຫຼັ້ມທີ່ ' . $volume . ' ຫນ້າ ' . $page,
|
|
|
|
| 123 |
$label = EtipitakaService::getLabel($code);
|
| 124 |
$prevPage = $page > 1 ? $page - 1 : null;
|
| 125 |
$nextPage = $page < $totalPages ? $page + 1 : null;
|
| 126 |
+
$volumes = EtipitakaService::getVolumes($code);
|
| 127 |
|
| 128 |
return view('pages.tipitaka.show', [
|
| 129 |
'content' => $content,
|
|
|
|
| 134 |
'prevPage' => $prevPage,
|
| 135 |
'nextPage' => $nextPage,
|
| 136 |
'totalPages' => $totalPages,
|
| 137 |
+
'volumes' => $volumes,
|
| 138 |
'seo' => [
|
| 139 |
'title' => 'E-Tipitaka - ເຫຼັ້ມທີ່ ' . $volume . ' ຫນ້າ ' . $page . ' (' . $label . ')',
|
| 140 |
'description' => 'ພຣະໄຕຣປິດກ ເຫຼັ້ມທີ່ ' . $volume . ' ຫນ້າ ' . $page,
|
views/pages/tipitaka/show.php
CHANGED
|
@@ -217,6 +217,27 @@ class="relative overflow-hidden min-h-screen pb-20" style="touch-action: manipul
|
|
| 217 |
<h1 class="text-xl sm:text-2xl md:text-3xl font-bold leading-tight Lao-font"><?= htmlspecialchars($label) ?></h1>
|
| 218 |
<p class="text-white/80 mt-1 text-xs sm:text-base Lao-font">ເຫຼັ້ມທີ່ <?= $volume ?> ຫນ້າ <?= $page ?></p>
|
| 219 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 220 |
</div>
|
| 221 |
<div class="flex justify-between items-center mt-3">
|
| 222 |
<div class="flex items-center gap-1 sm:gap-2">
|
|
|
|
| 217 |
<h1 class="text-xl sm:text-2xl md:text-3xl font-bold leading-tight Lao-font"><?= htmlspecialchars($label) ?></h1>
|
| 218 |
<p class="text-white/80 mt-1 text-xs sm:text-base Lao-font">ເຫຼັ້ມທີ່ <?= $volume ?> ຫນ້າ <?= $page ?></p>
|
| 219 |
</div>
|
| 220 |
+
<div x-data="{ open: false, vol: <?= $volume ?>, pg: <?= $page ?>, go() { if (this.vol && this.pg && this.pg >= 1) { window.location.href = '<?= url('/etipitaka/' . $code) ?>/' + this.vol + '/' + this.pg; } } }" class="relative flex-shrink-0">
|
| 221 |
+
<button @click="open = !open" class="flex items-center gap-1 px-2 py-1 rounded-lg bg-white/10 hover:bg-white/20 text-white/80 hover:text-white transition-colors text-xs sm:text-sm">
|
| 222 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M4 6h16M4 12h16M4 18h16" /></svg>
|
| 223 |
+
<span class="hidden sm:inline Lao-font">ກະໂດດ</span>
|
| 224 |
+
</button>
|
| 225 |
+
<div x-show="open" @click.away="open = false" x-transition:enter="transition ease-out duration-150" x-transition:enter-start="opacity-0 scale-95" x-transition:enter-end="opacity-100 scale-100" class="absolute right-0 top-full mt-2 bg-white rounded-xl shadow-xl border border-gray-100 p-3 min-w-[200px] z-30" style="display: none;">
|
| 226 |
+
<div class="flex flex-col gap-2">
|
| 227 |
+
<label class="text-xs text-gray-500 Lao-font">ເຫຼັ້ມທີ່</label>
|
| 228 |
+
<select x-model="vol" class="w-full px-2 py-1.5 border border-gray-200 rounded-lg text-sm text-gray-800 bg-white focus:border-[#795548] focus:ring-1 focus:ring-[#795548] outline-none">
|
| 229 |
+
<template x-for="v in <?= json_encode($volumes) ?>" :key="v">
|
| 230 |
+
<option :value="v" x-text="'ເຫຼັ້ມທີ່ ' + v"></option>
|
| 231 |
+
</template>
|
| 232 |
+
</select>
|
| 233 |
+
<label class="text-xs text-gray-500 Lao-font">ໜ້າ</label>
|
| 234 |
+
<div class="flex gap-1">
|
| 235 |
+
<input x-model.number="pg" type="number" min="1" @keydown.enter="go()" class="flex-1 w-20 px-2 py-1.5 border border-gray-200 rounded-lg text-sm text-gray-800 bg-white focus:border-[#795548] focus:ring-1 focus:ring-[#795548] outline-none" placeholder="ເລກໜ້າ">
|
| 236 |
+
<button @click="go()" class="px-3 py-1.5 bg-[#795548] text-white rounded-lg text-sm font-bold hover:bg-[#5E412D] transition-colors Lao-font">ໄປ</button>
|
| 237 |
+
</div>
|
| 238 |
+
</div>
|
| 239 |
+
</div>
|
| 240 |
+
</div>
|
| 241 |
</div>
|
| 242 |
<div class="flex justify-between items-center mt-3">
|
| 243 |
<div class="flex items-center gap-1 sm:gap-2">
|