diff options
| author | Nat Lasseter <user@4574.co.uk> | 2025-10-04 20:23:28 +0100 |
|---|---|---|
| committer | Nat Lasseter <user@4574.co.uk> | 2025-10-04 20:23:28 +0100 |
| commit | 4ac9d1b82f8778f3055fefdbc6ea88a3a5d2f347 (patch) | |
| tree | 59c3cd3a706a700e59844e8eec477dd59fd7325a /cgi/whisky-shelf.cgi | |
| parent | e468aad308191bf6c481cc8c781a40d638d1a2f6 (diff) | |
Draught whisky shelf page
Diffstat (limited to 'cgi/whisky-shelf.cgi')
| -rw-r--r-- | cgi/whisky-shelf.cgi | 22 |
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: |
