summaryrefslogtreecommitdiff
path: root/cgithub/views/_nav.eta
diff options
context:
space:
mode:
authorJoe Mou <dev@mou.fo>2026-01-27 16:58:56 -0500
committerJoe Mou <dev@mou.fo>2026-01-27 17:21:42 -0500
commit64c397e256b01a2e542e84529e947e237c07edd6 (patch)
tree2cbed000c4e53bcfeca33e749b271aba49dd7c0d /cgithub/views/_nav.eta
parent04bbba0a7b71f1fb090d3e3a73110a00c36bf765 (diff)
Split branch and path bread crumbs into separate section
Diffstat (limited to 'cgithub/views/_nav.eta')
-rw-r--r--cgithub/views/_nav.eta18
1 files changed, 18 insertions, 0 deletions
diff --git a/cgithub/views/_nav.eta b/cgithub/views/_nav.eta
new file mode 100644
index 0000000..338a6a6
--- /dev/null
+++ b/cgithub/views/_nav.eta
@@ -0,0 +1,18 @@
+<section>
+ <div class="branch"><img src="/static/icons/git-branch.svg" alt="branch" class="icon"> <%= it.branch %></div>
+ <% if (it.path && it.path !== "/") { %>
+ <a href="/<%= it.repo.owner %>/<%= it.repo.name %>/tree/<%= it.branch %>">(top)</a><%
+ const pathParts = it.path.split('/').filter(p => p);
+ let currentPath = '';
+ for (let i = 0; i < pathParts.length; i++) {
+ const part = pathParts[i];
+ currentPath += (currentPath ? '/' : '') + part;
+ const isLast = i === pathParts.length - 1;
+ if (isLast) {
+ %>/<%= part %><%= it.isTree ? "/" : "" %><%
+ } else {
+ %>/<a href="/<%= it.repo.owner %>/<%= it.repo.name %>/tree/<%= it.branch %>/<%= currentPath %>"><%= part %></a><%
+ }
+ } %>
+ <% } %>
+</section>