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 | |
| parent | e468aad308191bf6c481cc8c781a40d638d1a2f6 (diff) | |
Draught whisky shelf page
| -rwxr-xr-x | cgi/user.cgi | 3 | ||||
| -rw-r--r-- | cgi/whisky-shelf.cgi | 22 | ||||
| -rw-r--r-- | inc/shelf.json | 6 | ||||
| -rw-r--r-- | static/styles.css | 4 |
4 files changed, 35 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: diff --git a/inc/shelf.json b/inc/shelf.json new file mode 100644 index 0000000..de15d07 --- /dev/null +++ b/inc/shelf.json @@ -0,0 +1,6 @@ +[ + { + "name": "Elements of Islay Cask Edit", + "image": "caskedit.jpg" + } +] diff --git a/static/styles.css b/static/styles.css index aacacd2..91be7ce 100644 --- a/static/styles.css +++ b/static/styles.css @@ -30,6 +30,10 @@ div { padding: 1em; } +div.bottle { + float: left; +} + ul.toplinks { margin: 0; padding: 0; |
