diff options
| author | unwox <me@unwox.com> | 2024-10-08 14:07:45 +0600 |
|---|---|---|
| committer | unwox <me@unwox.com> | 2024-10-08 14:07:58 +0600 |
| commit | add39175e929ac28864dbdaaee773973567f682c (patch) | |
| tree | 32129ea7acfb230836d9b2caf4c8747c36f05d28 /bin | |
| parent | b9e86f6efc66dac7a46f4f098b0eb109c46f8a2b (diff) | |
small html/css improvements
Diffstat (limited to 'bin')
| -rw-r--r-- | bin/serve.fnl | 27 |
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 (.. "за " product.weight " гр.")] + "") + (if (and (< 1 product.weight) + product.price-per (< 0 product.price-per)) - [:NO-ESCAPE (.. " (" product.price-per "₽ за 1г)")] + [:NO-ESCAPE (.. " (" product.price-per "₽ за 1 гр.)")] "")] - [: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 {} |
