aboutsummaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
authorJoe Mou <dev@mou.fo>2026-08-11 08:25:08 -0400
committerJoe Mou <dev@mou.fo>2026-08-11 08:25:43 -0400
commitf198a174f204b164752a91aa774b1dee8c80f9e8 (patch)
treee98f0ce2a35910ce4084525a98016a16b7656962 /views
parent54430d7b02cc78b4a5aa5a4f917f8da85a385efe (diff)
Abbreviate commit hashes in branch picker
Diffstat (limited to 'views')
-rw-r--r--views/_nav.eta6
1 files changed, 5 insertions, 1 deletions
diff --git a/views/_nav.eta b/views/_nav.eta
index e3fbdcf..eb7ed42 100644
--- a/views/_nav.eta
+++ b/views/_nav.eta
@@ -1,6 +1,10 @@
<section>
+ <%
+ const isCommitHash = /^[0-9a-f]{40}$/.test(it.branch);
+ const refLabel = isCommitHash ? it.branch.slice(0, 7) : it.branch;
+ %>
<button type="button" class="ref-selector-button branch" command="show-modal" commandfor="ref-selector-menu">
- <img src="/static/icons/git-branch.svg" alt="branch" class="icon"> <%= it.branch %> ▾
+ <img src="/static/icons/git-branch.svg" alt="branch" class="icon"> <%= refLabel %> ▾
</button>
<dialog class="ref-selector-menu" id="ref-selector-menu" closedby="any" data-owner="<%= it.repo.owner %>" data-repo="<%= it.repo.name %>">
<div class="ref-selector-tabs">