From 93a063ed518f01c20bef3952f31baa2aa94aabb0 Mon Sep 17 00:00:00 2001 From: unwox Date: Sun, 14 Sep 2025 19:24:02 +0600 Subject: small display improvements --- pages/shop/_product/index.fnl | 53 +++++++++++++++++++++++++++---------------- 1 file changed, 34 insertions(+), 19 deletions(-) (limited to 'pages/shop/_product') diff --git a/pages/shop/_product/index.fnl b/pages/shop/_product/index.fnl index c3c2968..a9b7904 100644 --- a/pages/shop/_product/index.fnl +++ b/pages/shop/_product/index.fnl @@ -21,12 +21,15 @@ db "SELECT products.name, products.title, + products.short_description AS \"short-description\", products.description, products.price_per AS \"price-per\", products.type, + products.region, products.stock, products.packaging, products.published, + products.year, products.image1, products.image2, products.image3, @@ -50,28 +53,40 @@ [:div {:class "mb-1"} [:a {:href "/shop"} "⟵ Обратно к списку"]] [:div {:class "product-page-layout"} - [:div {} - [:h2 {:class "product-page-title"} - product.title - (if authenticated? - (HTML [:a {:style "font-size: 1rem; margin-left: 0.75rem;" - :href (.. "/shop/" product.name "/edit")} - "% Редактировать"]) - "")] - [:section {:class "mb-2"} - [:div {:class "mb-0-5" :style "font-style: italic;"} - (or (dicts.label dicts.tea-type product.type) product.type) ", " - (if (= product.packaging "piece") - (HTML [:strong {} product.price-per "₽ за 1 шт. "]) - (HTML [:span {} - [:strong {} (* 50 product.price-per) "₽ за 50 грамм "] - "(" product.price-per "₽ за 1 грамм)"]))]] + [:article {} + [:h2 {:class "product-page-title"} product.title] + (if authenticated? + (HTML + [:div {:class "mb-1" :style "margin-top: -0.5rem;"} + [:a {:href (.. "/shop/" product.name "/edit")} + "% Редактировать"]]) + "") + [:div {:class "mb-0-5" :style "font-style: italic;"} + (or (dicts.label dicts.product-type product.type) product.type) ", " + (if (not (lib.empty? product.year)) + (HTML [:span {} [:NO-ESCAPE (.. product.year " год, ")]]) + "") + (if (not (lib.empty? product.region)) (.. product.region ", ") "") + (if (= product.packaging "piece") + (HTML [:strong {} product.price-per "₽ за 1 шт. "]) + (HTML [:span {} + [:strong {} [:NO-ESCAPE + (* 50 product.price-per) + "₽ за 50 грамм "]] + [:NO-ESCAPE "(" product.price-per + "₽ за 1 грамм)"]]))] + [:div {:class "mb-1" :style "font-style: italic;"} + product.short-description] (let [link (.. "/static/files/" product.image1)] (HTML [:a {:href link :target "_blank"} - [:img {:class "product-page-img-mobile mb-2" + [:img {:class "product-page-img-mobile mb-1" :src (.. link "-thumbnail.jpg")}]])) - [:div {:class "mb-2"} "~~~"] - [:NO-ESCAPE (text->html product.description)]] + (if (not (lib.empty? product.description)) + (HTML [:div {:class "mb-1"} "***"]) + "") + (if (not (lib.empty? product.description)) + (HTML [:div {} [:NO-ESCAPE (text->html product.description)]]) + "")] [:div {:class "product-page-imgs"} (table.concat (icollect [idx image (ipairs images)] -- cgit v1.2.3