From 7aebba7531c0e29baba1c8c3725ac3597ad859ee Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Sat, 1 Aug 2020 22:54:58 -0400 Subject: feat(web/panettone): Add direct anchor links to comments Fixes: #31 Change-Id: I5a8228229eb2b68bdfc5addd305ab055443aa5a6 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1581 Reviewed-by: lukegb Tested-by: BuildkiteCI --- web/panettone/src/css.lisp | 10 +++++++++- web/panettone/src/panettone.lisp | 25 ++++++++++++++----------- 2 files changed, 23 insertions(+), 12 deletions(-) (limited to 'web/panettone/src') diff --git a/web/panettone/src/css.lisp b/web/panettone/src/css.lisp index 0192b816ea1c..40fa854eda16 100644 --- a/web/panettone/src/css.lisp +++ b/web/panettone/src/css.lisp @@ -77,7 +77,11 @@ (.comment-info :color ,color/gray :margin 0 - :padding-top "1rem") + :padding-top "1rem" + + (a :text-decoration "none") + ((:and a :hover) + :text-decoration "underline")) ((:or .comment .event) :padding-top "1rem" @@ -86,6 +90,10 @@ (p :margin 0)) + ((:and (:or .comment .event) :target) + :border-color ,color/primary + :border-bottom-width "3px") + (.event :color ,color/gray)))) 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 -- cgit 1.4.1