diff options
| author | unwox <me@unwox.com> | 2025-09-14 19:24:02 +0600 |
|---|---|---|
| committer | unwox <me@unwox.com> | 2025-09-14 19:24:02 +0600 |
| commit | 93a063ed518f01c20bef3952f31baa2aa94aabb0 (patch) | |
| tree | f6b23881129c596d22051c3aaf02bb85a759273f /pages/shop | |
| parent | 85feff4a72bade2488c7927624aae3f5af4769dc (diff) | |
small display improvements
Diffstat (limited to 'pages/shop')
| -rw-r--r-- | pages/shop/_product/index.fnl | 53 | ||||
| -rw-r--r-- | pages/shop/add.fnl | 2 | ||||
| -rw-r--r-- | pages/shop/index.fnl | 2 |
3 files changed, 36 insertions, 21 deletions
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)] diff --git a/pages/shop/add.fnl b/pages/shop/add.fnl index 5b5bfc5..99cfee3 100644 --- a/pages/shop/add.fnl +++ b/pages/shop/add.fnl @@ -15,7 +15,7 @@ (.. "Уникальное название чая на латинице, без пробелов, " "в нижнем регистре.")) (forms.text-input "title" "Полное название" true 0 200) - (forms.select-input "type" "Вид чая" true dicts.tea-type) + (forms.select-input "type" "Вид чая" true dicts.product-type) (forms.select-input "packaging" "Упаковка" true dicts.tea-packaging) (forms.number-input "year" "Год изготовления" false 1950 (tonumber (os.date "%Y"))) diff --git a/pages/shop/index.fnl b/pages/shop/index.fnl index 08770d0..0b9336e 100644 --- a/pages/shop/index.fnl +++ b/pages/shop/index.fnl @@ -70,7 +70,7 @@ "left: calc(100% / " (# images) " * " (- idx 1) ")")}])))]] [:a {:href item-url} [:h3 {:class "shop-item-title"} product.title]] [:div {:style "font-style: italic; margin-bottom: 0.25rem;"} - (or (dicts.label dicts.tea-type product.type) product.type) ", " + (or (dicts.label dicts.product-type product.type) product.type) ", " (if (= product.packaging "piece") (HTML [:strong {} product.price-per "₽ за 1 шт."]) (HTML [:strong {} (* 50 product.price-per) "₽ за 50 гр. "]))] |
