aboutsummaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
Diffstat (limited to 'views')
-rw-r--r--views/_nav.eta7
-rw-r--r--views/blob.eta3
-rw-r--r--views/commits.eta8
3 files changed, 16 insertions, 2 deletions
diff --git a/views/_nav.eta b/views/_nav.eta
index a20fbbc..a20741b 100644
--- a/views/_nav.eta
+++ b/views/_nav.eta
@@ -14,7 +14,10 @@
<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 crumbHrefBase = `/${it.repo.owner}/${it.repo.name}/${it.view === "blob" ? "tree" : it.view}/${it.branch}`;
+ %>
+ <a href="<%= crumbHrefBase %>">(top)</a><%
const pathParts = it.path.split('/').filter(p => p);
let currentPath = '';
for (let i = 0; i < pathParts.length; i++) {
@@ -24,7 +27,7 @@
if (isLast) {
%>/<%= part %><%= it.view === "tree" ? "/" : "" %><%
} else {
- %>/<a href="/<%= it.repo.owner %>/<%= it.repo.name %>/tree/<%= it.branch %>/<%= currentPath %>"><%= part %></a><%
+ %>/<a href="<%= crumbHrefBase %>/<%= currentPath %>"><%= part %></a><%
}
} %>
<% } %>
diff --git a/views/blob.eta b/views/blob.eta
index be9a57e..2014b14 100644
--- a/views/blob.eta
+++ b/views/blob.eta
@@ -8,6 +8,9 @@
<% } %>
<div><%= it.size %></div>
<div>
+ <a href="/<%= it.repo.owner %>/<%= it.repo.name %>/commits/<%= it.branch %>/<%= it.path %>">History</a>
+ </div>
+ <div>
<a href="/<%= it.repo.owner %>/<%= it.repo.name %>/raw/<%= it.branch %>/<%= it.path %>">View raw</a>
</div>
</div>
diff --git a/views/commits.eta b/views/commits.eta
index 5cf0beb..c29693d 100644
--- a/views/commits.eta
+++ b/views/commits.eta
@@ -2,6 +2,12 @@
<%~ include("./_nav.eta", {...it, view: "commits"}) %>
+<% const pathSuffix = it.path && it.path !== "/" ? "/" + it.path : "" %>
+
+<% if (it.commitGroups.length === 0) { %>
+ <div class="box">No commits found.</div>
+<% } %>
+
<% for (const group of it.commitGroups) { %>
<h3><%= group.title %></h3>
<% for (const commit of group.commits) { %>
@@ -19,6 +25,8 @@
</div>
<div class="commit-sha">
<code><%= commit.oid.substring(0, 7) %></code>
+ <% /* Like GitHub, blindly link to blob and redirect for trees */ %>
+ <a href="/<%= it.repo.owner %>/<%= it.repo.name %>/blob/<%= commit.oid %><%= pathSuffix %>">Browse</a>
</div>
</div>
<% } %>