summaryrefslogtreecommitdiff
path: root/playlist.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'playlist.lisp')
-rw-r--r--playlist.lisp40
1 files changed, 39 insertions, 1 deletions
diff --git a/playlist.lisp b/playlist.lisp
index 938972c..dbe982f 100644
--- a/playlist.lisp
+++ b/playlist.lisp
@@ -301,6 +301,43 @@
(format nil "Error while fetching track at: ~a~%"
url)))))))))))
+(defun create-editor-managment (parent playlist)
+ (when (eq (session-user parent) (playlist-user playlist))
+ (with-clog-create parent
+ (div ()
+ (section (:h3 :content "Collaborators"))
+ (unordered-list (:bind editor-list))
+ (button (:content "Add Contributor" :bind addbtn))
+ (form-element (:text :bind userinput))
+ (span (:bind username-status)))
+ (setf (place-holder userinput) "who?"
+ (width userinput ) 140)
+ (flet ((create-editor-item (editor)
+ (with-clog-create editor-list
+ (p (:content (user-name editor) :bind editor-elem)
+ (button (:content "remove" :bind delbtn)))
+ (set-on-click
+ delbtn
+ (thunk*
+ (remove-editor playlist editor)
+ (destroy editor-elem))))))
+ (set-on-key-press
+ userinput
+ (thunk*
+ (setf (text username-status)
+ (if (user-with-name (value userinput))
+ "✔" "No user with that name"))))
+ (set-on-click
+ addbtn
+ (thunk*
+ (when-let (user (user-with-name (value userinput)))
+ (add-editor playlist user)
+ (setf (value userinput) ""
+ (text username-status) "")
+ (create-editor-item user))))
+ (dolist (editor (playlist-editors playlist))
+ (create-editor-item editor))))))
+
(defun playlist-key-from-url (url)
(first (last (ppcre:split "/" (nth 4 (multiple-value-list (quri:parse-uri url)))))))
@@ -322,7 +359,8 @@
(now-playing-display (ctl))
(track-listing (pl))
- (new-track-form (pl)))
+ (new-track-form (pl))
+ (editor-managment (pl)))
(setf (pl-title ctl) title-elem
(pl-dur ctl) dur-elem
(display input) "none"