summaryrefslogtreecommitdiff
path: root/cgithub/public/static/refs.js
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
commit866f99c414cb3d102483ce21c68a0e62b394baaa (patch)
tree973b8e526bf51e8a05f6daab262d84035b7e2901 /cgithub/public/static/refs.js
parent10f923b51e2844486651493b44974e418a2be6d9 (diff)
Keep the ref picker on the current view and path
Diffstat (limited to 'cgithub/public/static/refs.js')
-rw-r--r--cgithub/public/static/refs.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/cgithub/public/static/refs.js b/cgithub/public/static/refs.js
index ffff505..f3e07e8 100644
--- a/cgithub/public/static/refs.js
+++ b/cgithub/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];