summaryrefslogtreecommitdiff
path: root/bin/serve.fnl
diff options
context:
space:
mode:
Diffstat (limited to 'bin/serve.fnl')
-rw-r--r--bin/serve.fnl39
1 files changed, 14 insertions, 25 deletions
diff --git a/bin/serve.fnl b/bin/serve.fnl
index a0c5fc4..f9563ec 100644
--- a/bin/serve.fnl
+++ b/bin/serve.fnl
@@ -295,33 +295,22 @@
""))
(fn menu-template [path extra-class]
+ (local item
+ (fn [item-path title]
+ [:a {:href item-path
+ :class (if (= path item-path) "active" "")}
+ title]))
[:nav {:class (.. "menu" (if (str.empty? extra-class)
""
(.. " " extra-class)))}
- [:a {:href "/red-tea"
- :class (if (= path "/red-tea") "active" "")}
- "Красный чай"]
- [:a {:href "/sheng-puer"
- :class (if (= path "/sheng-puer") "active" "")}
- "Шен пуэр"]
- [:a {:href "/shou-puer"
- :class (if (= path "/shou-puer") "active" "")}
- "Шу пуэр"]
- [:a {:href "/oolong"
- :class (if (= path "/oolong") "active" "")}
- "Улун"]
- [:a {:href "/green-tea"
- :class (if (= path "/green-tea") "active" "")}
- "Зеленый чай"]
- [:a {:href "/white-tea"
- :class (if (= path "/white-tea") "active" "")}
- "Белый чай"]
- [:a {:href "/yellow-tea"
- :class (if (= path "/yellow-tea") "active" "")}
- "Желтый чай"]
- [:a {:href "/teaware"
- :class (if (= path "/teaware") "active" "")}
- "Посуда"]])
+ (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 paginator]
[:aside {:class "aside"}
@@ -420,7 +409,7 @@
(fn root-handler [{: path : query}]
(local cache-key (.. "page:" path "?" (serialize-query query)))
(local cached (cache.get db cache-key))
- (if false
+ (if cached
(values 200 {:content-type "text/html"} cached)
(do
(fn respond [query category]