From 8aeabd81cd7aa5d1227d24eb3f81c34ebab57184 Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Wed, 2 Nov 2022 10:09:40 -0500 Subject: Add: user pages and links to user pages in playlists --- playlist.lisp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'playlist.lisp') 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" + (key u) (user-name u)) + when more do (princ ", " out))))) (when (editorp ctl) (setf (attribute title-elem "title") "Click to edit the title.") -- cgit v1.2.3