Link home asset entries to their detail pages
Each recent-asset row is now an anchor to /assets/:id, with the link
styling stripped so the row keeps its catalog look.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N92HLTepkg3AtRpDUyZ54o
diff --git a/lib/views/home.rb b/lib/views/home.rb
index f363814..25dc7fe 100644
--- a/lib/views/home.rb
+++ b/lib/views/home.rb
@@ -108,7 +108,7 @@ module Domus
def archive
div(class: "archive") do
@assets.each do |asset|
- div(class: "entry") do
+ a(class: "entry", href: "/assets/#{asset[:id]}") do
span(class: "chip") { icon("box") }
div(class: "body") do
div(class: "nm") { plain asset[:name] }
diff --git a/public/app.css b/public/app.css
index 2c2e332..01a3163 100644
--- a/public/app.css
+++ b/public/app.css
@@ -441,6 +441,8 @@ body {
border-top: 1px solid var(--w-line);
cursor: pointer;
transition: background .12s ease;
+ color: inherit;
+ text-decoration: none;
}
.entry:first-child { border-top: 0; }
.entry:hover { background: var(--w-fill); }
diff --git a/test/test_app.rb b/test/test_app.rb
index 0461087..c0c375a 100644
--- a/test/test_app.rb
+++ b/test/test_app.rb
@@ -37,6 +37,14 @@ class TestApp < Minitest::Test
assert_operator body.index("Newer asset"), :<, body.index("Older asset")
end
+ def test_root_links_each_asset_to_its_detail_page
+ id = domus.db[:assets].insert(name: "Laptop", created_at: Time.now)
+
+ get "/"
+ assert_equal 200, last_response.status
+ assert_includes last_response.body, %(href="/assets/#{id}")
+ end
+
def test_root_empty_state
get "/"
assert_equal 200, last_response.status