summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorunwox <me@unwox.com>2024-10-22 00:47:37 +0600
committerunwox <me@unwox.com>2024-10-22 00:47:37 +0600
commita24b2b3de7995d28420f09c988fbb7ef31d0e15c (patch)
tree36b3b135d6b46f8ed87101f913531bfe9d281a64 /bin
parent190ce50d172f9d2b1d2114f43fa80e92f28da03e (diff)
move sites information to corresponding parser modules
Diffstat (limited to 'bin')
-rw-r--r--bin/serve.fnl36
1 files changed, 9 insertions, 27 deletions
diff --git a/bin/serve.fnl b/bin/serve.fnl
index f9563ec..ade091b 100644
--- a/bin/serve.fnl
+++ b/bin/serve.fnl
@@ -228,28 +228,10 @@
0)})
(fn site-name-template [name]
- (if
- (= name "ipuer")
- [:a {:class "site-icon" :href "https://ipuer.ru"}
- [:img {:src "/static/ipuer.jpg" :alt "Логотип Институт чай пуэр"}]
- "Институт чая пуэр"]
- (= name "artoftea")
- [:a {:class "site-icon" :href "https://artoftea.ru"}
- [:img {:src "/static/artoftea.png" :alt "Логотип Art of tea"}]
- "Art of tea"]
- (= name "ozchai")
- [:a {:class "site-icon" :href "https://ozchai.ru"}
- [:img {:src "/static/ozchai.ico" :alt "Логотип #OZCHAI"}]
- "Чайная #OZCHAI"]
- (= name "clubcha")
- [:a {:class "site-icon" :href "https://clubcha.ru"}
- [:img {:src "/static/clubcha.png" :alt "Логотип Железный Феникс"}]
- "Железный Феникс"]
- (= name "chaekshop")
- [:a {:class "site-icon" :href "https://chaekshop.ru"}
- [:img {:src "/static/chaekshop.svg" :alt "Логотип Интернет-магазин «Чаёк»"}]
- "Интернет-магазин «Чаёк»"]
- ""))
+ (local module (require (.. "parser." name)))
+ [:a {:class "site-icon" :href module.url}
+ [:img {:src (.. "/static/" name ".png") :alt (.. "Логотип " module.title)}]
+ module.title])
(fn item-template [product]
[:div {:class "tile"}
@@ -325,8 +307,8 @@
[:form {:class "form"}
[:input {:type :search :name "query" :value form.query
:autofocus true :placeholder "Поисковый запрос"}]
- [:div {:class "form-tags"}
- [:select {:class "form-tag" :name "tags"}
+ [:div {}
+ [:select {:name "tags"}
[:option {:value ""} "~ Категория ~"]
(table.unpack
(map
@@ -345,15 +327,15 @@
[:input {:type :checkbox :id "price-per" :name "price-per"
:checked (if form.price-per "checked" nil)}]
[:label {:for "price-per"} "цена за грамм"]]
- [:div {:class "form-tags"}
- [:select {:class "form-tag" :name "site"}
+ [:div {}
+ [:select {:name "site"}
[:option {:value ""} "~ Сайт ~"]
(table.unpack
(map
(fn [_ val]
[:option {:value val
:selected (if (= form.site val) "selected" nil)}
- val])
+ (. (require (.. "parser." val)) :title)])
[:ozchai :clubcha :ipuer :artoftea :chaekshop]))]]
[:button {:type :submit} "Искать"]]
paginator]])