diff options
author | Grant Shangreaux <grant@unabridgedsoftware.com> | 2023-01-08 21:39:19 -0600 |
---|---|---|
committer | Grant Shangreaux <grant@unabridgedsoftware.com> | 2023-01-08 21:39:19 -0600 |
commit | db23eebb6f5a1fb40c7c7e6467a3c66b13e10e42 (patch) | |
tree | 27bec039f2543043da07d364fba393c284b622e1 | |
parent | 040a7dc9970f1f402d99934f5cd5398bde4f28f8 (diff) |
Add: synchronized download link appear/delete across clientszip-downloads
-rw-r--r-- | playlist.lisp | 25 | ||||
-rw-r--r-- | zipper.lisp | 2 |
2 files changed, 18 insertions, 9 deletions
diff --git a/playlist.lisp b/playlist.lisp index e320906..e8f9c57 100644 --- a/playlist.lisp +++ b/playlist.lisp @@ -12,7 +12,7 @@ (now-playing-track :std nil :doc "An instance of track-ctl") (np-title np-artist np-thumb np-dur np-time np-play :std nil :doc "Now Playing Elements") - (pl-title pl-tracks pl-dur pl-zip + (pl-title pl-tracks pl-dur pl-zip pl-download :std nil :doc "Playlist Elements")) (:documentation "Holds the complete state for this session's viewing of a particular playlist.")) @@ -191,6 +191,7 @@ (when (delete-track-at (playlist curctl) pos) (delete-zipped-playlist curctl) (for-playlist-viewers container ctl + (destroy (pl-zip ctl)) (let ((track-ctl (nth pos (tracks ctl)))) (destroy (container track-ctl)) (setf (tracks ctl) (delete track-ctl (tracks ctl)) @@ -202,6 +203,7 @@ (when (swap-tracks (playlist curctl) pos (1+ pos)) (delete-zipped-playlist curctl) (for-playlist-viewers (container track-ctl) ctl + (destroy (pl-zip ctl)) (let* ((cur (nth pos (tracks ctl))) (next @@ -218,6 +220,7 @@ (when (swap-tracks (playlist curctl) pos (1- pos)) (delete-zipped-playlist curctl) (for-playlist-viewers (container track-ctl) ctl + (destroy (pl-zip ctl)) (let* ((cur (nth pos (tracks ctl))) (next @@ -228,6 +231,11 @@ ;; swap list items in the dom (place-after (container cur) (container next))))))) +(defun add-zipped-playlist-link (pl-ctl playlist) + "Adds the link to a zipped playlist to the DOM." + (for-playlist-viewers (pl-download pl-ctl) ctl + (setf (pl-zip ctl) (make-zipped-playlist-link playlist (pl-download ctl))) + (place-inside-bottom-of (pl-download ctl) (pl-zip ctl)))) ;;; CLIENT UI @@ -284,7 +292,7 @@ (defun create-track-list-item (list track ctl) (with-clog-create list (list-item (:bind container) - + (div (:bind item :class "track-list-item") (section (:pre :content (track-listing-line track)))) (div (:bind edit-controls) @@ -441,19 +449,15 @@ (track-listing (pl)))) (div (:class "row") - (div (:class "column") + (div (:class "column" :bind dl-elem) (button (:content "Create Zipped Playlist" :bind zip-download-button))) (div () (new-track-form (pl)) (editor-managment (pl))))) - (set-on-click zip-download-button - (thunk* - (zip-playlist pl) - (setf (pl-zip ctl) (make-zipped-playlist-link pl body)) - (place-after zip-download-button (pl-zip ctl)))) (setf (pl-title ctl) title-elem (pl-dur ctl) dur-elem + (pl-download ctl) dl-elem (display input) "none" (display title-elem) "inline") @@ -461,6 +465,11 @@ (setf (pl-zip ctl) (make-zipped-playlist-link pl body)) (place-after zip-download-button (pl-zip ctl))) + (set-on-click zip-download-button + (thunk* + (zip-playlist pl) + (add-zipped-playlist-link ctl pl))) + (when (playlist-editors pl) (setf (inner-html collaborators-elem) (with-output-to-string (out) diff --git a/zipper.lisp b/zipper.lisp index 0271159..8ed37aa 100644 --- a/zipper.lisp +++ b/zipper.lisp @@ -43,7 +43,7 @@ (defun make-zipped-playlist-link (playlist context) (when (zipped-playlist-exists-p playlist) - (create-a context :link (zipped-playlist-url playlist) :content "Download" :target "_blank"))) + (create-a context :link (zipped-playlist-url playlist) :content "Download" :target "_blank" :auto-place nil))) (defun delete-zipped-playlist (playlist-ctl) "Deletes the zipped playlist file and removes the associated link element. |