summaryrefslogtreecommitdiff
path: root/cgithub/views/_refs.eta
diff options
context:
space:
mode:
authorJoe Mou <dev@mou.fo>2026-08-11 13:32:44 -0400
committerJoe Mou <dev@mou.fo>2026-08-11 17:37:02 -0400
commit866f99c414cb3d102483ce21c68a0e62b394baaa (patch)
tree973b8e526bf51e8a05f6daab262d84035b7e2901 /cgithub/views/_refs.eta
parent10f923b51e2844486651493b44974e418a2be6d9 (diff)
Keep the ref picker on the current view and path
Diffstat (limited to 'cgithub/views/_refs.eta')
-rw-r--r--cgithub/views/_refs.eta6
1 files changed, 5 insertions, 1 deletions
diff --git a/cgithub/views/_refs.eta b/cgithub/views/_refs.eta
index 2450c4b..9d951cc 100644
--- a/cgithub/views/_refs.eta
+++ b/cgithub/views/_refs.eta
@@ -1,10 +1,14 @@
+<%
+const linkPrefix = `/${it.repo.owner}/${it.repo.name}/${it.view}/`;
+const linkSuffix = it.path ? `/${it.path}` : "";
+%>
<% if (it.refs.length === 0) { %>
<div class="ref-selector-empty">No <%= it.type %> found.</div>
<% } else { %>
<ul class="ref-selector-items">
<% for (const ref of it.refs) { %>
<li>
- <a href="/<%= it.repo.owner %>/<%= it.repo.name %>/tree/<%= ref.name %>"><%= ref.name %></a>
+ <a href="<%= linkPrefix %><%= ref.name %><%= linkSuffix %>"><%= ref.name %></a>
<% if (ref.isDefault) { %><span class="ref-selector-badge">default</span><% } %>
</li>
<% } %>