aboutsummaryrefslogtreecommitdiff
path: root/cgi
diff options
context:
space:
mode:
Diffstat (limited to 'cgi')
-rwxr-xr-xcgi/user.cgi3
-rw-r--r--cgi/whisky-shelf.cgi22
2 files changed, 25 insertions, 0 deletions
diff --git a/cgi/user.cgi b/cgi/user.cgi
index 9a27c40..98c5280 100755
--- a/cgi/user.cgi
+++ b/cgi/user.cgi
@@ -14,6 +14,7 @@ def toplinks
$cgi.ul(class: "toplinks") {
$cgi.li { link("/" , "Home" ) } +
$cgi.li { link("/bins" , "Bins" ) } +
+# $cgi.li { link("/shelf" , "Shelf" ) } +
$cgi.li { link("/eamit.html" , "eamit" , true) } +
$cgi.li { link("https://git.4574.co.uk/", "Git" , true) } +
$cgi.li { link("/stuff-i-want" , "Stuff I Want" ) }
@@ -90,6 +91,8 @@ when "/"
page("Home", "User_4574's Lair")
when "/bins"
page("Bins")
+when "/shelf"
+ page("Whisky Shelf")
when /^\/stuff-i-want/
page("Stuff I Want")
when /^\/bv/
diff --git a/cgi/whisky-shelf.cgi b/cgi/whisky-shelf.cgi
new file mode 100644
index 0000000..37948ca
--- /dev/null
+++ b/cgi/whisky-shelf.cgi
@@ -0,0 +1,22 @@
+require "json"
+
+def shelf_contents(data)
+ data.map { |bottle|
+ $cgi.div(class: "bottle") {
+ $cgi.h3 { bottle["name"] } +
+ $cgi.img(width: "300px",
+ height: "500px",
+ src: "/static/shelf/#{bottle["image"]}")
+ }
+ }.join
+end
+
+data = JSON.parse(File.read("../inc/shelf.json"))
+
+$page =
+ $cgi.div {
+ $cgi.h2 { "What's on my shelf?" } +
+ shelf_contents(data)
+ }
+
+# vim: set filetype=ruby: