summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunwox <me@unwox.com>2024-12-06 20:03:45 +0600
committerunwox <me@unwox.com>2024-12-06 20:03:45 +0600
commit72f9d7b798f9f94c3166fb0ee7ba938c6ca7ae02 (patch)
treefe2ff80096788f0ec8f6c747a0631062728a5bfb
parentc542b03f5a50ad0fb5d283c39c662bc7fbe97db4 (diff)
use luna.debug for disabling cache and some other small tweaks
-rw-r--r--bin/serve.fnl24
1 files changed, 13 insertions, 11 deletions
diff --git a/bin/serve.fnl b/bin/serve.fnl
index 8cdd673..5cfc535 100644
--- a/bin/serve.fnl
+++ b/bin/serve.fnl
@@ -393,14 +393,14 @@
[:nav {:class (.. "menu" (if (str.empty? extra-class)
""
(.. " " extra-class)))}
- (item "/red-tea" "Красный чай")
- (item "/sheng-puer" "Шен пуэр")
- (item "/shou-puer" "Шу пуэр")
- (item "/oolong" "Улун")
- (item "/green-tea" "Зеленый чай")
- (item "/white-tea" "Белый чай")
- (item "/yellow-tea" "Желтый чай")
- (item "/teaware" "Посуда")])
+ (item "/red-tea" "Красный чай")
+ (item "/sheng-puer" "Шен пуэр")
+ (item "/shou-puer" "Шу пуэр")
+ (item "/oolong" "Улун")
+ (item "/green-tea" "Зеленый чай")
+ (item "/white-tea" "Белый чай")
+ (item "/yellow-tea" "Желтый чай")
+ (item "/teaware" "Посуда")])
(fn aside-template [form path aside-content]
[:aside {:class "aside"}
@@ -414,7 +414,10 @@
(menu-template path "menu-mobile")
[:form {:class "form"}
[:input {:type :search :name "query" :value form.query
- :autofocus true :placeholder "Поисковый запрос"}]
+ ;; autofocus makes browser scroll up to the input on reloads
+ ;; and that doesn't work well with _G.reload
+ :autofocus (if luna.debug nil true)
+ :placeholder "Поисковый запрос"}]
[:div {}
[:select {:name "tags"}
[:option {:value ""} "~ Тег ~"]
@@ -564,8 +567,7 @@
(cache.set db cache-key
(.. "<!DOCTYPE html>\n" (html.render page true)))))
- ;; TODO: if !dev && cached
- (if cached
+ (if (and (not luna.debug) cached)
(values 200 {:content-type "text/html"} cached)
(do
(local form (collect-form query))