aboutsummaryrefslogtreecommitdiffhomepage
path: root/playlist.lisp
diff options
context:
space:
mode:
authorColin Okay <colin@cicadas.surf>2022-11-02 10:09:40 -0500
committerColin Okay <colin@cicadas.surf>2022-11-02 10:09:40 -0500
commit8aeabd81cd7aa5d1227d24eb3f81c34ebab57184 (patch)
tree8dbe7e22fcc34b9121650f3f73e8f4c6ca253884 /playlist.lisp
parent3a0b65f86ce67ccff391ea6c1dcf978f7807fb33 (diff)
Add: user pages and links to user pages in playlists
Diffstat (limited to 'playlist.lisp')
-rw-r--r--playlist.lisp16
1 files changed, 12 insertions, 4 deletions
diff --git a/playlist.lisp b/playlist.lisp
index 5ff57bd..3ddffda 100644
--- a/playlist.lisp
+++ b/playlist.lisp
@@ -400,6 +400,9 @@
(dolist (editor (playlist-editors playlist))
(create-editor-item editor))))))
+(defun url-to-user (user)
+ (format nil "/user/~a" (key user)))
+
(defun playlist-key-from-url (url)
(first (last (ppcre:split "/" (nth 4 (multiple-value-list (quri:parse-uri url)))))))
@@ -424,7 +427,8 @@
(form-element (:text :bind input))
(:span (:content " -- "))
(:span (:bind dur-elem :content (secs-to-hms (playlist-duration pl)))))
- (p (:content (format nil "by ~a" (user-name (playlist-user pl)))))
+ (a (:link (url-to-user (playlist-user pl))
+ :content (format nil "by ~a" (user-name (playlist-user pl)))))
(p (:bind collaborators-elem))
(track-listing (pl))))
(div (:class "row")
@@ -437,9 +441,13 @@
(display title-elem) "inline")
(when (playlist-editors pl)
- (setf (text collaborators-elem)
- (format nil "with help from ~{~a~^, ~}"
- (mapcar #'user-name (playlist-editors pl)))))
+ (setf (inner-html collaborators-elem)
+ (with-output-to-string (out)
+ (princ "with help from " out)
+ (loop for (u . more) on (playlist-editors pl)
+ do (format out "<a href='/user/~a'>~a</a>"
+ (key u) (user-name u))
+ when more do (princ ", " out)))))
(when (editorp ctl)
(setf (attribute title-elem "title") "Click to edit the title.")