From 72f9d7b798f9f94c3166fb0ee7ba938c6ca7ae02 Mon Sep 17 00:00:00 2001 From: unwox Date: Fri, 6 Dec 2024 20:03:45 +0600 Subject: use luna.debug for disabling cache and some other small tweaks --- bin/serve.fnl | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'bin/serve.fnl') 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 (.. "\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)) -- cgit v1.2.3