summaryrefslogtreecommitdiff
path: root/cgithub/views/_nav.eta
blob: e3fbdcf7de66547abb5cfa4599218e06b408827a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<section>
  <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 %> ▾
  </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">
      <button type="button" class="active" data-ref-type="branches">Branches</button>
      <button type="button" data-ref-type="tags">Tags</button>
    </div>
    <div class="ref-selector-list">Loading…</div>
  </dialog>
  <% 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>