summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rw-r--r--bin/serve.fnl27
1 files changed, 17 insertions, 10 deletions
diff --git a/bin/serve.fnl b/bin/serve.fnl
index f98a5ff..eb56d8a 100644
--- a/bin/serve.fnl
+++ b/bin/serve.fnl
@@ -60,19 +60,22 @@
(fn item-template [product]
[:div {:class "tile"}
- [:a {:href product.url :style "display: block;"}
- [:img {:src product.image} ""]]
+ [:a {:href product.url :style "display: block;" :rel "nofollow"}
+ [:img {:src product.image :title product.title :alt product.title} ""]]
(site-name-template product.site)
- [:a {:href product.url :style "text-decoration: none;"}
+ [:a {:href product.url :style "text-decoration: none;" :rel "nofollow"}
[:NO-ESCAPE (.. "<h2>" (unescape product.title) "</h2>")]]
[:div {:class "price"}
(if product.price (.. product.price "₽") "")
- (if product.quantity (.. " за " product.quantity "г") "")
- (if (and product.price-per
+ (if (< 0 product.weight)
+ [:NO-ESCAPE (.. "за&nbsp;" product.weight "&nbsp;гр.")]
+ "")
+ (if (and (< 1 product.weight)
+ product.price-per
(< 0 product.price-per))
- [:NO-ESCAPE (.. " (" product.price-per "₽ за&nbsp;1г)")]
+ [:NO-ESCAPE (.. " (" product.price-per "₽ за&nbsp;1&nbsp;гр.)")]
"")]
- [:small {} (or product.description "")]])
+ [:small {} (unescape (str.truncate product.description 200))]])
(fn paginator-template [query page limit total]
(local last-page (math.ceil (/ total limit)))
@@ -109,11 +112,15 @@
[:div {:class "content"}
[:aside {:class "aside"}
[:div {:class "aside-content"}
- [:a {:href "/" :style "display: block;"}
- [:img {:class "logo" :src "static/logo.svg" :alt "Логотип meicha.ru"}]]
+ (if (~= query "")
+ [:a {:href "/" :style "display: block;"}
+ [:img {:class "logo" :src "static/logo.svg"
+ :alt "Логотип meicha.ru" :title "Логотип meicha.ru"}]]
+ [:img {:class "logo" :src "static/logo.svg"
+ :alt "Логотип meicha.ru" :title "Логотип meicha.ru"}])
[:form {:class "form"}
[:input {:type :search :name :query :value query
- :autofocus true :placeholder "enter search query"}]
+ :autofocus true :placeholder "Введите поисковый запрос"}]
[:button {:type :submit} "Искать"]]
paginator]]
[:section {}