Add the lazy loading for articles on the index page.

This commit is contained in:
2024-04-11 14:29:01 +03:00
parent c24fce08f3
commit 76cd096f70
5 changed files with 28 additions and 8 deletions
+2 -2
View File
@@ -10,7 +10,7 @@
id (.-id (.-params req))]
(go
(try
(let [articles (<! (db/get-articles client channel))]
(let [articles (<! (db/get-articles-briefly client channel))]
(res/status 200)
(.render res "index"
(-> {:articles articles}
@@ -49,7 +49,7 @@
(res/send (ex-message "404")))
(do
(res/status 200)
(.render res "article_briefly"
(.render res "article_full"
(-> {:article article :layout false}
(cljs.core/clj->js))))))
(catch js/Error err
+4 -2
View File
@@ -4,8 +4,10 @@
(defn truncatestring-factory
[]
(fn [text limit]
(-> (. text substring 0 limit)
(str "..."))))
(if (> (. text -length) limit)
(-> (. text substring 0 limit)
(str "..."))
text)))
(defn full-timestamp-factory
[]