summaryrefslogtreecommitdiff
path: root/pages/shop/index.fnl
diff options
context:
space:
mode:
Diffstat (limited to 'pages/shop/index.fnl')
-rw-r--r--pages/shop/index.fnl22
1 files changed, 11 insertions, 11 deletions
diff --git a/pages/shop/index.fnl b/pages/shop/index.fnl
index 5a96ab2..bbe08fa 100644
--- a/pages/shop/index.fnl
+++ b/pages/shop/index.fnl
@@ -1,4 +1,4 @@
-(import-macros {:compile-html <>} :macros)
+(import-macros {:compile-html HTML} :macros)
(local lib (require :lib))
(local dicts (require :dicts))
(local templates (require :templates))
@@ -42,16 +42,16 @@
;; (if (< 0 product.stock)
;; (each [_ q (ipairs (quantity-steps product.stock 50))]
;; (table.insert quantity-options
- ;; (<>
+ ;; (HTML
;; [:option {:value (tostring q)}
;; (.. q " грамм за " (* product.price-per q) "₽")])))
- ;; (table.insert quantity-options (<> [:option {:value "0"} "Товар закончился"])))
+ ;; (table.insert quantity-options (HTML [:option {:value "0"} "Товар закончился"])))
(local images [])
(for [i 2 5]
(table.insert images (. product (.. "image" i))))
- (<>
+ (HTML
[:section {:class (.. "shop-item"
(if (not product.published)
" shop-item-not-published" ""))}
@@ -61,7 +61,7 @@
:src (.. "/static/files/" (. product.image1) "-thumbnail.jpg")}]
(table.concat
(icollect [idx image (ipairs images)]
- (<>
+ (HTML
[:img {:class "shop-item-img" :src (.. "/static/files/" image "-thumbnail.jpg")
:loading "lazy"
:style (.. "z-index: " (+ idx 2) ";"
@@ -79,11 +79,11 @@
[:div {} product.short-description]]))
(fn content [db basket basket-total authenticated?]
- [(<>
+ [(HTML
[:div {:class "side"}
(templates.header "/shop" authenticated?)
(if (< 0 (# basket))
- (<>
+ (HTML
[:article {:class "article"}
[:h2 {} "Корзина"]
[:div {}
@@ -94,14 +94,14 @@
[:div {:class "basket-total"} (.. "Итого: " basket-total "₽")]
[:a {:href "/shop/order"} "Оформить заказ"]])
"")])
- (<>
+ (HTML
[:div {:class "content"}
[:div {:class "mb-1"} [:a {:href "/"} "⟵ Обратно на главную"]]
[:h2 {:class "mb-1 product-page-title"}
"Магазин"
(if authenticated?
- (<> [:a {:style "font-size: 1rem; margin-left: 0.75rem;"
- :href (.. "/shop/add")} "+ Добавить"])
+ (HTML [:a {:style "font-size: 1rem; margin-left: 0.75rem;"
+ :href (.. "/shop/add")} "+ Добавить"])
"")]
[:div {:class "shop-items"}
(let [products (all-products db authenticated?)]
@@ -109,7 +109,7 @@
(table.concat
(icollect [_ v (ipairs products)]
(item-template v)))
- (<> [:em {} "Пока что здесь ничего нет!"])))]])])
+ (HTML [:em {} "Пока что здесь ничего нет!"])))]])])
(fn create-order [db]
(let [id (_G.must (luna.crypto.random-string 64))]