diff options
author | Colin Okay <colin@cicadas.surf> | 2022-10-26 16:57:20 -0500 |
---|---|---|
committer | Colin Okay <colin@cicadas.surf> | 2022-10-26 16:57:20 -0500 |
commit | 52ef147c0c9894f285656d4f67bf8d7052d9660b (patch) | |
tree | a02120e9f8f22f7d2bc5d42063c3162329441b31 /playlist.lisp | |
parent | acebbb24c9ae406e41fb3798ccb31a95d73d2207 (diff) |
Add: edit playlist title
Diffstat (limited to 'playlist.lisp')
-rw-r--r-- | playlist.lisp | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/playlist.lisp b/playlist.lisp index 82f6f49..b71e4d7 100644 --- a/playlist.lisp +++ b/playlist.lisp @@ -70,6 +70,10 @@ (with-transaction () (make-instance 'playlist :title title :user user))) +(defun update-playlist-title (playlist title) + (with-transaction () + (setf (playlist-title playlist) title))) + ;;; CLIENT STATE (defclass/std playlist-ctl () @@ -372,9 +376,32 @@ (install-new-playlist-ctl pl body))) (with-clog-create body (div () - (section (:h2 :content (playlist-title-content pl) :bind title-elem)) + (section (:h2 :content (playlist-title pl) :bind title-elem)) + (form () + (form-element (:text :bind input))) (now-playing-display (ctl)) (track-listing (pl)) (new-track-form (pl))) - (setf (pl-title ctl) title-elem) + (setf (pl-title ctl) title-elem + (display input) "none") + + (set-on-blur + input + (alambda + (when (plusp (length (value input))) + (update-playlist-title pl (value input)) + (setf (text title-elem) (value input))) + (setf (display input) "none" + (display title-elem) "block"))) + + (set-on-click + title-elem + (alambda + (setf (value input) (text title-elem) + (display input) "inline" + (display title-elem) "none") + (focus input))) + (initialize-now-playing body))))) + +(create-form-element ) |