aboutsummaryrefslogtreecommitdiff
path: root/views/_nav.eta
blob: 338a6a6577eb1a5d6d4544e34d2fa1ed4bfe6c43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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>