templates/repo.tmpl
browsing at commit = 83d9be6f3ed9d9cb365012fe26dc2b2cd733ae64
<% c++ #include "content.h" %>
<% c++ #include "util.h" %>
<% skin git %>
<% view repo_home uses content::repo_home extends master %>
<% template content_body() %>
<h1><%= repo %></h1>
<p class="meta">default branch: <%= default_branch %> · commit <%= commit_oid %></p>
<p class="actions">
<a href="/repos/<%= repo %>/tree/<%= query %>">files</a> ·
<a href="/repos/<%= repo %>/log/<%= query %>">log</a>
</p>
<% if (content.clone_http.length() > 0 or content.clone_https.length() > 0) %>
<div class="checkout">
<h2>Checkout</h2>
<% if (content.clone_http.length() > 0) %>
<p class="clone-line"><span class="clone-label">Non-GitHub</span> <code>git clone <%= clone_http %></code></p>
<% end %>
<% if (content.clone_https.length() > 0) %>
<p class="clone-line"><span class="clone-label">HTTPS</span> <code>git clone <%= clone_https %></code></p>
<p class="clone-line"><span class="clone-label">SSH</span> <code>git clone <%= clone_ssh %></code></p>
<% end %>
</div>
<% end %>
<% if (content.readme_name.length() > 0) %>
<article id="readme" class="readme markdown">Loading README…</article>
<div class="markdown-src" data-target="#readme" hidden><%= readme_text %></div>
<% else %>
<p>No README found.</p>
<% end %>
<% end template %>
<% end view %>
<% view tree_view uses content::tree_view extends master %>
<% template content_body() %>
<h1><%= repo %><% if (content.path.length() > 0) %>/<%= path %><% end %></h1>
<% if (content.query.length() > 0) %>
<p class="commit-notice">browsing at commit = <%= commit_oid %></p>
<% end %>
<% if (not content.on_default_branch) %>
<% if (content.branches.size() > 0) %>
<p class="tags">branches: <% foreach b in branches %><% item %><a href="/repos/<%= repo %>/tree/?id=<%= b.target_oid %>"><%= b.name %></a> <% end item %><% end foreach %></p>
<% else %>
<p class="tags">not on any branch</p>
<% end %>
<% end %>
<% if (content.tags.size() > 0) %>
<p class="tags">tags: <% foreach t in tags %><% item %><a href="/repos/<%= repo %>/tags/<%= t %>"><%= t %></a> <% end item %><% end foreach %></p>
<% end %>
<% if (content.entries.size() > 0) %>
<p class="tree-controls"><button type="button" class="view-toggle" aria-pressed="false">view: list</button></p>
<% end %>
<table class="tree">
<% if (not content.is_root) %>
<tr><td class="name"><a href="/repos/<%= repo %>/tree/<%= parent_path %><%= query %>">..</a></td><td></td></tr>
<% end %>
<% foreach e in entries %><% item %>
<tr>
<td class="name">
<% if e.is_dir %>
<a class="dir" href="/repos/<%= repo %>/tree/<%= e.path %><%= query %>"><%= e.name %>/</a>
<% else %>
<% if e.is_submodule %>
<span class="submodule"><%= e.name %> @ <%= e.oid %></span>
<% else %>
<a href="/repos/<%= repo %>/tree/<%= e.path %><%= query %>"><%= e.name %></a>
<% end %>
<% end %>
</td>
<td class="size"><% if e.is_dir %><% else %><% if e.is_submodule %><% else %><% c++ out() << util::human_size(e.size); %><% end %><% end %></td>
</tr>
<% end item %><% empty %>
<tr><td>empty tree</td></tr>
<% end %>
</table>
<div class="tree-grid" hidden>
<% if (not content.is_root) %>
<a class="tile dir" href="/repos/<%= repo %>/tree/<%= parent_path %><%= query %>"><span class="tile-icon">📁</span><span class="tile-name">..</span></a>
<% end %>
<% foreach e in entries %><% item %>
<% if e.is_dir %>
<a class="tile dir" href="/repos/<%= repo %>/tree/<%= e.path %><%= query %>"><span class="tile-icon">📁</span><span class="tile-name"><%= e.name %>/</span></a>
<% else %>
<% if e.is_submodule %>
<span class="tile submodule"><span class="tile-icon">🔗</span><span class="tile-name"><%= e.name %></span></span>
<% else %>
<a class="tile" href="/repos/<%= repo %>/tree/<%= e.path %><%= query %>">
<% if e.is_image %>
<img class="thumb" loading="lazy" src="/repos/<%= repo %>/raw/<%= e.path %><%= query %>" alt="<%= e.name %>">
<% else %>
<span class="tile-icon">📄</span>
<% end %>
<span class="tile-name"><%= e.name %></span></a>
<% end %>
<% end %>
<% end item %><% end %>
</div>
<% end template %>
<% end view %>
<% view file_view uses content::file_view extends master %>
<% template content_body() %>
<h1><%= path %></h1>
<% if (content.query.length() > 0) %>
<p class="commit-notice">browsing at commit = <%= commit_oid %></p>
<% end %>
<% if (not content.on_default_branch) %>
<% if (content.branches.size() > 0) %>
<p class="tags">branches: <% foreach b in branches %><% item %><a href="/repos/<%= repo %>/tree/?id=<%= b.target_oid %>"><%= b.name %></a> <% end item %><% end foreach %></p>
<% else %>
<p class="tags">not on any branch</p>
<% end %>
<% end %>
<% if (content.tags.size() > 0) %>
<p class="tags">tags: <% foreach t in tags %><% item %><a href="/repos/<%= repo %>/tags/<%= t %>"><%= t %></a> <% end item %><% end foreach %></p>
<% end %>
<p class="actions">
<a href="/repos/<%= repo %>/raw/<%= path %><%= query %>">raw</a> ·
<a href="/repos/<%= repo %>/blame/<%= path %><%= query %>">blame</a> ·
<a href="/repos/<%= repo %>/log/<%= query %>">history</a>
</p>
<% if is_image %>
<p class="fileimg"><img src="/repos/<%= repo %>/raw/<%= path %><%= query %>" alt="<%= filename %>"></p>
<% if not empty text %>
<pre class="code"><code class="hljs" data-filename="<%= filename %>"><%= text %></code></pre>
<% end %>
<% else %>
<% if is_binary %>
<p class="binary">Binary file (<% c++ out() << util::human_size(content.size); %>) —
<a href="/repos/<%= repo %>/raw/<%= path %><%= query %>">view raw</a></p>
<% else %>
<% if is_markdown %>
<article id="filemd" class="readme markdown">Loading…</article>
<div class="markdown-src" data-target="#filemd" hidden><%= text %></div>
<% else %>
<pre class="code"><code class="hljs" data-filename="<%= filename %>"><%= text %></code></pre>
<% end %>
<% end %>
<% end %>
<% end template %>
<% end view %>
<% view blame_view uses content::blame_view extends master %>
<% template content_body() %>
<h1>blame: <%= path %></h1>
<p class="actions">
<a href="/repos/<%= repo %>/tree/<%= path %><%= query %>">normal view</a> ·
<a href="/repos/<%= repo %>/raw/<%= path %><%= query %>">raw</a>
</p>
<table class="blame">
<% foreach l in lines %><% item %>
<tr>
<td class="commit"><a href="/repos/<%= repo %>/commit/<%= l.short_oid %>"><%= l.short_oid %></a></td>
<td class="author"><%= l.author %></td>
<td class="date"><% c++ out() << util::format_time(l.time); %></td>
<td class="lineno"><%= l.number %></td>
<td class="line"><pre><%= l.content %></pre></td>
</tr>
<% end item %><% end foreach %>
</table>
<% end template %>
<% end view %>
<% end skin %>