summaryrefslogtreecommitdiff
path: root/cgithub/views
diff options
context:
space:
mode:
Diffstat (limited to 'cgithub/views')
-rw-r--r--cgithub/views/tree.eta42
1 files changed, 42 insertions, 0 deletions
diff --git a/cgithub/views/tree.eta b/cgithub/views/tree.eta
new file mode 100644
index 0000000..4194216
--- /dev/null
+++ b/cgithub/views/tree.eta
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <title><%= it.repo.owner %>/<%= it.repo.name %> - <%= it.path || 'root' %></title>
+ <link rel="stylesheet" href="/static/style.css">
+</head>
+<body>
+ <header>
+ <h1><%= it.repo.owner %>/<%= it.repo.name %></h1>
+ <div>branch: <%= it.branch %></div>
+ <% if (it.path) { %>
+ <div>
+ path: <a href="/<%= it.repo.owner %>/<%= it.repo.name %>/tree/<%= it.branch %>">root</a><%
+ const pathParts = it.path.split('/').filter(p => p);
+ let currentPath = '';
+ for (const part of pathParts) {
+ currentPath += (currentPath ? '/' : '') + part;
+ %>/<a href="/<%= it.repo.owner %>/<%= it.repo.name %>/tree/<%= it.branch %>/<%= currentPath %>"><%= part %></a><%
+ } %>
+ </div>
+ <% } %>
+ </header>
+
+ <table>
+ <% for (const item of it.items) { %>
+ <tr>
+ <td>
+ <span class="icon"><%= item.contentType === 'directory' ? '📁' : '📄' %></span>
+ <% if (item.contentType === 'directory') { %>
+ <a href="/<%= it.repo.owner %>/<%= it.repo.name %>/tree/<%= it.branch %>/<%= item.path %>"><%= item.name %></a>
+ <% } else { %>
+ <%= item.name %>
+ <% } %>
+ </td>
+ </tr>
+ <% } %>
+ </table>
+
+ <footer>Generated by cgithub</footer>
+</body>
+</html>