diff options
| author | Joe Mou <dev@mou.fo> | 2026-09-03 01:37:35 -0400 |
|---|---|---|
| committer | Joe Mou <dev@mou.fo> | 2026-09-03 22:16:44 -0400 |
| commit | a52481a3884447f94aad2d97e0407112c818a32d (patch) | |
| tree | b8edcac1bf9d8bd80bf1ac78d292fe6589eee4ec /views/commits.eta | |
| parent | 80be2418ff2615b454c5edf2819861f58eecf271 (diff) | |
Link blobs to their history and back
Nothing in a commits payload says whether the path it lists is a file or
a directory: currentBlobPath, despite the name, is only the path filter,
and is set for a directory just the same. GitHub's own UI cannot tell
either, and points its browse button at /blob/<oid>/<path> so that the
redirect resolves a file to its blob. We do the same, and the blob route
already turns that redirect into one of our own tree URLs.
Breadcrumbs now stay in the view they were clicked from, so walking up
from a history lands in the history of each parent directory rather than
in its listing. The last crumb remains the page you are already on.
A path with no commits now says so rather than rendering an empty page.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R7pRKdmTvNDgT4ZXrwkbH8
Diffstat (limited to 'views/commits.eta')
| -rw-r--r-- | views/commits.eta | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/views/commits.eta b/views/commits.eta index 5cf0beb..c29693d 100644 --- a/views/commits.eta +++ b/views/commits.eta @@ -2,6 +2,12 @@ <%~ include("./_nav.eta", {...it, view: "commits"}) %> +<% const pathSuffix = it.path && it.path !== "/" ? "/" + it.path : "" %> + +<% if (it.commitGroups.length === 0) { %> + <div class="box">No commits found.</div> +<% } %> + <% for (const group of it.commitGroups) { %> <h3><%= group.title %></h3> <% for (const commit of group.commits) { %> @@ -19,6 +25,8 @@ </div> <div class="commit-sha"> <code><%= commit.oid.substring(0, 7) %></code> + <% /* Like GitHub, blindly link to blob and redirect for trees */ %> + <a href="/<%= it.repo.owner %>/<%= it.repo.name %>/blob/<%= commit.oid %><%= pathSuffix %>">Browse</a> </div> </div> <% } %> |
