about summary refs log tree commit diff
path: root/web/panettone/src/panettone.lisp
diff options
context:
space:
mode:
authorGriffin Smith <grfn@gws.fyi>2020-08-02T02·54-0400
committerglittershark <grfn@gws.fyi>2020-08-02T02·57+0000
commit7aebba7531c0e29baba1c8c3725ac3597ad859ee (patch)
treef83508cf7675034a6c40c28a51306b3bb7898b75 /web/panettone/src/panettone.lisp
parent688d4c6be3847e1aa5f9d946cb69a3ac2332e961 (diff)
feat(web/panettone): Add direct anchor links to comments r/1547
Fixes: #31
Change-Id: I5a8228229eb2b68bdfc5addd305ab055443aa5a6
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1581
Reviewed-by: lukegb <lukegb@tvl.fyi>
Tested-by: BuildkiteCI
Diffstat (limited to 'web/panettone/src/panettone.lisp')
-rw-r--r--web/panettone/src/panettone.lisp25
1 files changed, 14 insertions, 11 deletions
diff --git a/web/panettone/src/panettone.lisp b/web/panettone/src/panettone.lisp
index dc3a1cc29547..d70110ef54df 100644
--- a/web/panettone/src/panettone.lisp
+++ b/web/panettone/src/panettone.lisp
@@ -272,23 +272,26 @@
 (defgeneric render/issue-history-item (item))
 
 (defmethod render/issue-history-item ((comment model:issue-comment))
-  (who:with-html-output (*standard-output*)
-    (who:htm
-     (:li
-      :class "comment"
-      (:p (who:str (body comment)))
-      (:p
-       :class "comment-info"
-       (:span :class "username"
-              (who:esc (displayname (author comment)))
-              " at "
-              (who:esc (format-dottime (created-at comment)))))))))
+  (let ((fragment (format nil "comment-~A" (id comment))))
+    (who:with-html-output (*standard-output*)
+      (:li
+       :class "comment"
+       :id fragment
+       (:p (who:str (body comment)))
+       (:p
+        :class "comment-info"
+        (:span :class "username"
+               (who:esc (displayname (author comment)))
+               " at "
+               (:a :href (concatenate 'string "#" fragment)
+                   (who:esc (format-dottime (created-at comment))))))))))
 
 (defmethod render/issue-history-item ((event model:issue-event))
   (let ((user (find-user-by-dn (acting-user-dn event))))
     (who:with-html-output (*standard-output*)
       (:li
        :class "event"
+       :id
        (who:esc (displayname user))
        (if (string= (field event) "STATUS")
            (who:htm