summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <code@mail.matthias.benkard.de>2012-04-10 11:16:13 +0200
committerMatthias Andreas Benkard <code@mail.matthias.benkard.de>2012-04-10 11:16:13 +0200
commit557332e37a7f615bafb767d8ba388c5a3a729944 (patch)
tree2dd1a541a136b05ba0a5fa10997b4580e87cf9d6 /src
parent0691218f525e2546448613863c8bd684f80c297f (diff)
Lafargue: Add desktop notification feature for WebKit-based browsers.
Diffstat (limited to 'src')
-rw-r--r--src/mulk/benki/book_marx.clj4
-rw-r--r--src/mulk/benki/lazychat.clj14
2 files changed, 12 insertions, 6 deletions
diff --git a/src/mulk/benki/book_marx.clj b/src/mulk/benki/book_marx.clj
index 80fac1e..5c556c2 100644
--- a/src/mulk/benki/book_marx.clj
+++ b/src/mulk/benki/book_marx.clj
@@ -87,8 +87,8 @@
(let [marks (bookmarks-visible-by *user*)]
(with-dbt
(layout bookmarx-list-page "Book Marx"
- [:div {:id "login-message"
- :class "login-message"}
+ [:div {:id "notifications"
+ :class "notifications"}
(login-message)]
[:div
;;(.toString marks)
diff --git a/src/mulk/benki/lazychat.clj b/src/mulk/benki/lazychat.clj
index 6865d01..e2caaf8 100644
--- a/src/mulk/benki/lazychat.clj
+++ b/src/mulk/benki/lazychat.clj
@@ -20,7 +20,8 @@
hiccup.core
[lamina.core :as lamina]
[aleph.http :as ahttp]
- [aleph.formats :as aformats])
+ [aleph.formats :as aformats]
+ [clojure.data.json :as json])
(:import [org.apache.abdera Abdera]))
@@ -120,12 +121,17 @@
[:div {:class "lafargue-message-body"}
(sanitize-html (markdown->html (:content message)))]]))
+(defn render-message-as-json [message]
+ (json/json-str (assoc message
+ :html (render-message message)
+ :date nil)))
+
(defpage "/lafargue" {}
(with-dbt
(layout lafargue-list-page "Lafargue Lazy Chat"
- [:div {:id "login-message"
- :class "login-message"}
+ [:div {:id "notifications"
+ :class "notifications"}
(login-message)]
[:div
[:div {:id "lafargue-main-input-box" :class "lafargue-input-box"}
@@ -185,7 +191,7 @@
(let [messages (filter* #(may-read? *user* %) lafargue-events)]
(receive-all messages
(fn [msg]
- (async-push conn (render-message msg)))))
+ (async-push conn (render-message-as-json msg)))))
(async-push conn {:status 426})))
(defpage [:any "/lafargue/post"] {content :content, visibility :visibility