aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--playlist.lisp58
1 files changed, 33 insertions, 25 deletions
diff --git a/playlist.lisp b/playlist.lisp
index 5d0dc24..531789a 100644
--- a/playlist.lisp
+++ b/playlist.lisp
@@ -17,7 +17,8 @@
(:documentation "Holds the complete state for this session's viewing of a particular playlist."))
(defclass/std track-ctl ()
- ((track listing-line audio container info-edit-ctl edit-save-btn editing? :std nil))
+ ((track listing-line audio container info-edit-ctl edit-save-btn editing?
+ artist-input album-input title-input :std nil))
(:documentation "The state of a particular track in this session's viewing of a playlist."))
(defun audio-for-track (ctl track)
@@ -228,38 +229,30 @@
(place-after (container cur) (container next)))))))
(defun open-track-editor (track-ctl)
- (setf (text (edit-save-btn track-ctl)) "save ")
- (with-slots (artist album title) (track track-ctl)
- (with-clog-create (info-edit-ctl track-ctl)
- (div (:class "track-edit-inputs column")
- ;; (label (:content "Artist" :bind artist-label))
- (form-element (:text :bind artist-input))
- ;; (label (:content "Album" :bind album-label))
- (form-element (:text :bind album-input))
- ;; (label (:content "Title" :bind title-label))
- (form-element (:text :bind title-input)))
+ (setf (display (info-edit-ctl track-ctl)) "inline"
+ (text (edit-save-btn track-ctl)) "save "
+ (editing? track-ctl) t)
+ (with-slots (artist-input album-input title-input) track-ctl
+ (with-slots (artist album title) (track track-ctl)
(setf (place-holder artist-input) (or artist "Artist")
(place-holder album-input) (or album "Album")
(place-holder title-input) (or title "Title"))
- ;; (label-for artist-input artist-label)
- ;; (label-for album-input album-label)
- ;; (label-for title-input title-label)
-
(set-on-click
(edit-save-btn track-ctl)
(thunk* (update-track-info
(track track-ctl) (value artist-input) (value album-input) (value title-input))
- (toggle-track-editor track-ctl))))))
+ (close-track-editor track-ctl))
+ :one-time t))))
(defun close-track-editor (track-ctl)
(setf (display (info-edit-ctl track-ctl)) "none"
(text (listing-line track-ctl)) (track-listing-line (track track-ctl))
- (text (edit-save-btn track-ctl)) "edit "))
-
-(defun toggle-track-editor (track-ctl)
- (setf (editing? track-ctl) (not (editing? track-ctl)))
- (if (editing? track-ctl) (open-track-editor track-ctl)
- (close-track-editor track-ctl)))
+ (text (edit-save-btn track-ctl)) "edit "
+ (editing? track-ctl) nil)
+ (set-on-click
+ (edit-save-btn track-ctl)
+ (thunk* (open-track-editor track-ctl))
+ :one-time t))
(defun add-zipped-playlist-link (pl-ctl playlist)
"Adds the link to a zipped playlist to the DOM."
@@ -325,13 +318,24 @@
(div (:bind item :class "track-list-item")
(section (:pre :bind listing-line)))
- (div (:bind info-edit-ctl :class "track-list-edit"))
+ (div (:bind info-edit-ctl :class "track-list-edit")
+ (div (:class "track-edit-inputs column")
+ ;; (label (:content "Artist" :bind artist-label))
+ (form-element (:text :bind artist-input))
+ ;; (label (:content "Album" :bind album-label))
+ (form-element (:text :bind album-input))
+ ;; (label (:content "Title" :bind title-label))
+ (form-element (:text :bind title-input))))
(div (:bind edit-controls)
(button (:content "edit " :bind edit-save-btn))
(button (:content "delete " :bind delbtn))
(button (:content "↓" :bind downbtn))
(button (:content "↑" :bind upbtn)))
(audio (:source (media-url-path track) :controls nil :bind audio)))
+ ;; (label-for artist-input artist-label)
+ ;; (label-for album-input album-label)
+ ;; (label-for title-input title-label)
+
(let ((track-ctl
(make-instance 'track-ctl
:container container
@@ -340,15 +344,19 @@
:track track
:info-edit-ctl info-edit-ctl
:edit-save-btn edit-save-btn
+ :artist-input artist-input
+ :album-input album-input
+ :title-input title-input
:editing? nil)))
(setf (tracks ctl)
(insert-nth track-ctl -1 (tracks ctl) t)
- (text listing-line) (track-listing-line track))
+ (text listing-line) (track-listing-line track)
+ (display info-edit-ctl) "none")
(cond
((editorp ctl)
(setf (attribute downbtn "title") "move track down"
(attribute upbtn "title") "move track up")
- (set-on-click edit-save-btn (thunk* (toggle-track-editor track-ctl)))
+ (set-on-click edit-save-btn (thunk* (open-track-editor track-ctl)) :one-time t)
(set-on-click delbtn (thunk* (remove-track track-ctl)))
(set-on-click downbtn (thunk* (move-track-down track-ctl)))
(set-on-click upbtn (thunk* (move-track-up track-ctl))))