aboutsummaryrefslogtreecommitdiff
path: root/cgi/whisky-shelf.cgi
diff options
context:
space:
mode:
Diffstat (limited to 'cgi/whisky-shelf.cgi')
-rw-r--r--cgi/whisky-shelf.cgi22
1 files changed, 22 insertions, 0 deletions
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: