aboutsummaryrefslogtreecommitdiff
path: root/public/static
diff options
context:
space:
mode:
authorJoe Mou <dev@mou.fo>2026-08-11 13:32:44 -0400
committerJoe Mou <dev@mou.fo>2026-08-11 17:37:02 -0400
commit32ed69b43aeca42e88ab37187246e1035d4c933f (patch)
treeb11e637e784d96e285ffe43568d9d53f1def4911 /public/static
parentd2c94ae32ff8d88f438d0e3348ca4f4a81f7bdd7 (diff)
Keep the ref picker on the current view and path
Diffstat (limited to 'public/static')
-rw-r--r--public/static/refs.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/public/static/refs.js b/public/static/refs.js
index ffff505..f3e07e8 100644
--- a/public/static/refs.js
+++ b/public/static/refs.js
@@ -7,7 +7,9 @@ document.addEventListener("DOMContentLoaded", () => {
const dialog = document.querySelector(".ref-selector-menu");
if (dialog) {
const list = dialog.querySelector(".ref-selector-list");
- const { owner, repo } = dialog.dataset;
+ // The view and path let the picker link to the same place on another ref
+ // rather than to the repository root.
+ const { owner, repo, view, path = "" } = dialog.dataset;
const cache = {};
async function load(type) {
@@ -17,7 +19,7 @@ document.addEventListener("DOMContentLoaded", () => {
}
list.textContent = "Loading…";
try {
- const res = await fetch(`/api/${owner}/${repo}/refs/${type}`);
+ const res = await fetch(`/api/${owner}/${repo}/refs/${type}/${view}/${path}`);
const html = res.ok ? await res.text() : "";
cache[type] = html || "Failed to load.";
list.innerHTML = cache[type];