blob: 65163b204782a73c1cc368d80dc60c4fc526feb1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
;;;; user.lisp
(in-package :vampire)
;;; CLIENT STATE
(defclass/std user-ctl ()
())
;;; CLIENT CONTROL
;;; CLIENT UI
(defun create-new-playlist-form (parent &rest args)
(declare (ignorable args))
(with-clog-create parent
(div ()
(section (:h2 :content "Create New Playlist"))
(label (:content "Playlist Title:"))
(form-element (:text :bind pl-title))
(button (:content "Create" :bind btn)))
(set-on-click
btn
(alambda
(new-playlist (session-user parent) :title (value pl-title))
(reload (location (connection-body parent)))))))
(defun url-to-playlist (pl location)
(format nil "~a//~a/playlist/~a"
(protocol location)
(host location)
(key pl)))
(defun create-playlist-listing (parent &rest args)
(declare (ignorable args))
(dolist (pl (user-playlists (session-user parent)))
(let ((url
(url-to-playlist pl (location (connection-body parent)))))
(with-clog-create parent
(div ()
(section (:h4)
(a (:link url :content (playlist-title pl) :bind pl-link))))
(set-on-click
pl-link
(alambda
(setf (url (location (connection-body parent)))
url)))))))
(defun user-home-page (body)
(if-let (user (session-user body))
(with-clog-create body
(div ()
(p (:content (format nil "Welcome ~a" (user-name user))))
(new-playlist-form ())
(playlist-listing ())))
(setf (url (location body)) "/")))
|