summaryrefslogtreecommitdiff
path: root/webapps/music-dispensary/site.lisp
diff options
context:
space:
mode:
authorckonstanski <ckonstanski@pippiandcarlos.com>2018-02-06 21:42:54 -0700
committerckonstanski <ckonstanski@pippiandcarlos.com>2018-02-06 21:42:54 -0700
commit142166df54eda65925921799a4bb3e7f6cdaba48 (patch)
tree5dc70e16bd6719079651925b5c5769211a3bf27e /webapps/music-dispensary/site.lisp
initial commit
Diffstat (limited to 'webapps/music-dispensary/site.lisp')
-rw-r--r--webapps/music-dispensary/site.lisp76
1 files changed, 76 insertions, 0 deletions
diff --git a/webapps/music-dispensary/site.lisp b/webapps/music-dispensary/site.lisp
new file mode 100644
index 0000000..f74236c
--- /dev/null
+++ b/webapps/music-dispensary/site.lisp
@@ -0,0 +1,76 @@
+;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-
+(declaim (optimize (speed 0) (safety 3) (debug 3)))
+
+(in-package #:music-dispensary)
+
+;; ========================================================================== ;;
+
+(defmacro .base ()
+ `(html5
+ `(html
+ (head
+ ((meta :name "viewport" :content "width=device-width, initial-scale=1"))
+ ((meta :charset "utf-8"))
+ ((title) ,(title *webapp*))
+ ,@(mapcar (lambda (css)
+ `((link :rel "stylesheet" :href ,css)))
+ '("https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css")))
+ ,@(mapcar (lambda (js)
+ `((script :type "text/javascript" :src ,js)))
+ '("https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"
+ "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"
+ "/static/js/cljs/main.js"))
+ (body
+ ((div :class "container-fluid")
+ ((div :class "page-header")
+ ((h2 :align "center") ,(title *webapp*)))
+ ((div :id "menu" :class "well"))
+ ((div :id "errormsg"))
+ ((div :id "message"))
+ ((div :id "body")))))))
+
+;; ========================================================================== ;;
+
+(defmacro .location ()
+ `(location-json))
+
+(defmacro .home ()
+ `(home-json))
+
+(defmacro .menu ()
+ `(menu-json))
+
+(defmacro .login ()
+ `(login-json))
+
+(defmacro .login-authenticate ()
+ `(login-authenticate-json username password))
+
+(defmacro .logout ()
+ `(logout-json))
+
+(defmacro .browse ()
+ `(browse-json))
+
+(defmacro .browse-browser ()
+ `(browse-browser-json relative-path node))
+
+(defmacro .browse-papersize ()
+ `(browse-papersize-json))
+
+(defmacro .browse-generate ()
+ `(browse-generate-json file papersize))
+
+;; ========================================================================== ;;
+
+(define-endpoint :get "/" () .base)
+(define-endpoint :get "/location" () .location)
+(define-endpoint :get "/home" () .home)
+(define-endpoint :get "/menu" () .menu)
+(define-endpoint :get "/login" () .login)
+(define-endpoint :post "/login/authenticate" ((username :parameter-type 'string) (password :parameter-type 'string)) .login-authenticate)
+(define-endpoint :get "/logout" () .logout)
+(define-endpoint :get "/browse" () .browse)
+(define-endpoint :post "/browse/browser" ((relative-path :parameter-type 'string) (node :parameter-type 'string)) .browse-browser)
+(define-endpoint :get "/browse/papersize" () .browse-papersize)
+(define-endpoint :post "/browse/generate" ((file :parameter-type 'string) (papersize :parameter-type 'string)) .browse-generate)