Merged
feat: klap mappen in de bestandsboom in
timfa
wants to merge
1 commit
from
cursor/boom-inklappen-674d
into
master
Overview Commits 1 Pipelines 3 Changes 9
Er stond geen open MR voor de bestandsweergave. Onafhankelijke scrollbalken en inklapbare mappen zitten daarom samen in deze MR.
De bestandslijst en de code hebben elk een eigen scrollbar. Een map klapt dicht als je op de map of de chevron klikt; de chevron draait mee. De map van het geopende bestand en de mappen erboven staan open. De open- of dicht-stand per repository blijft in localStorage, maar de mappen naar het huidige bestand gaan bij het laden weer open zodat dat bestand zichtbaar blijft. Zoeken toont een treffer ook als de map dicht was.
Deze branch is apart van MR !12 (het profiel). Beide raken pages.html en repo.js. Als de ene eerst mergt, moet de andere even opnieuw op master gezet worden.
Activity
- timfa Pipeline #80 is Passed 23 October 2026
- timfa opened this merge request 23 October 2026
- timfa Pipeline #82 is Passed 23 October 2026
- timfa Pipeline #83 is Passed 23 October 2026
-
timfa
pushed
23 October 2026
feat: klap mappen in de bestandsboom in Merge branch 'cursor/profielblok-674d' into 'master' feat: toon repositories en groepen op het profiel
- timfa merged this merge request 23 October 2026
Commits
- feat: klap mappen in de bestandsboom in
f3820e6327timfa
Pipelines
Changes
@@ -141,6 +141,7 @@ var en = map[string]string{
"repo.created": "Created on %s",
"repo.history": "History",
"repo.files": "Files",
"repo.fold": "Collapse or expand folder",
"repo.binary": "Binary file.",
"repo.noTags": "No tags yet.",
"tag.search": "Find a tag",
@@ -141,6 +141,7 @@ var en = map[string]string{ "repo.created": "Created on %s", "repo.created": "Created on %s", "repo.history": "History", "repo.history": "History", "repo.files": "Files", "repo.files": "Files", "repo.fold": "Collapse or expand folder", "repo.binary": "Binary file.", "repo.binary": "Binary file.", "repo.noTags": "No tags yet.", "repo.noTags": "No tags yet.", "tag.search": "Find a tag", "tag.search": "Find a tag",@@ -146,6 +146,7 @@ var nl = map[string]string{
"repo.created": "Aangemaakt op %s",
"repo.history": "Geschiedenis",
"repo.files": "Bestanden",
"repo.fold": "Map in- of uitklappen",
"repo.binary": "Binair bestand.",
"repo.noTags": "Nog geen tags.",
"tag.search": "Zoek een tag",
@@ -767,6 +768,7 @@ var de = map[string]string{
"repo.created": "Erstellt am %s",
"repo.history": "Verlauf",
"repo.files": "Dateien",
"repo.fold": "Ordner ein- oder ausklappen",
"repo.binary": "Binäre Datei.",
"repo.noTags": "Noch keine Tags.",
"tag.search": "Tag suchen",
@@ -1388,6 +1390,7 @@ var fr = map[string]string{
"repo.created": "Créé le %s",
"repo.history": "Historique",
"repo.files": "Fichiers",
"repo.fold": "Replier ou déplier le dossier",
"repo.binary": "Fichier binaire.",
"repo.noTags": "Pas encore de tags.",
"tag.search": "Chercher un tag",
@@ -146,6 +146,7 @@ var nl = map[string]string{ "repo.created": "Aangemaakt op %s", "repo.created": "Aangemaakt op %s", "repo.history": "Geschiedenis", "repo.history": "Geschiedenis", "repo.files": "Bestanden", "repo.files": "Bestanden", "repo.fold": "Map in- of uitklappen", "repo.binary": "Binair bestand.", "repo.binary": "Binair bestand.", "repo.noTags": "Nog geen tags.", "repo.noTags": "Nog geen tags.", "tag.search": "Zoek een tag", "tag.search": "Zoek een tag",@@ -767,6 +768,7 @@ var de = map[string]string{ "repo.created": "Erstellt am %s", "repo.created": "Erstellt am %s", "repo.history": "Verlauf", "repo.history": "Verlauf", "repo.files": "Dateien", "repo.files": "Dateien", "repo.fold": "Ordner ein- oder ausklappen", "repo.binary": "Binäre Datei.", "repo.binary": "Binäre Datei.", "repo.noTags": "Noch keine Tags.", "repo.noTags": "Noch keine Tags.", "tag.search": "Tag suchen", "tag.search": "Tag suchen",@@ -1388,6 +1390,7 @@ var fr = map[string]string{ "repo.created": "Créé le %s", "repo.created": "Créé le %s", "repo.history": "Historique", "repo.history": "Historique", "repo.files": "Fichiers", "repo.files": "Fichiers", "repo.fold": "Replier ou déplier le dossier", "repo.binary": "Fichier binaire.", "repo.binary": "Fichier binaire.", "repo.noTags": "Pas encore de tags.", "repo.noTags": "Pas encore de tags.", "tag.search": "Chercher un tag", "tag.search": "Chercher un tag",@@ -160,13 +160,15 @@ func treeRows(entries []gitrepo.Entry, current string) []FileRow {
if depth > 8 {
depth = 8
}
dir := e.Type == "tree"
inside := current == e.Name || strings.HasPrefix(current, e.Name+"/")
active := e.Name == current
if e.Type == "tree" && (current == e.Name || strings.HasPrefix(current, e.Name+"/")) {
if dir && inside {
active = true
}
out = append(out, FileRow{
Name: base, Path: e.Name, Dir: e.Type == "tree", Icon: fileIcon(base, e.Type),
Depth: depth, Active: active,
Name: base, Path: e.Name, Dir: dir, Icon: fileIcon(base, e.Type),
Depth: depth, Active: active, Open: dir && inside,
})
}
return out
@@ -160,13 +160,15 @@ func treeRows(entries []gitrepo.Entry, current string) []FileRow { if depth > 8 { if depth > 8 { depth = 8 depth = 8 } } dir := e.Type == "tree" inside := current == e.Name || strings.HasPrefix(current, e.Name+"/") active := e.Name == current active := e.Name == current if e.Type == "tree" && (current == e.Name || strings.HasPrefix(current, e.Name+"/")) { if dir && inside { active = true active = true } } out = append(out, FileRow{ out = append(out, FileRow{ Name: base, Path: e.Name, Dir: e.Type == "tree", Icon: fileIcon(base, e.Type), Name: base, Path: e.Name, Dir: dir, Icon: fileIcon(base, e.Type), Depth: depth, Active: active, Depth: depth, Active: active, Open: dir && inside, }) }) } } return out return out@@ -687,6 +687,9 @@ type FileRow struct {
Dir bool
Depth int
Active bool
// Open geldt voor een map die het huidige pad bevat. De browser
// onthoudt afwijkingen daarvan per repository.
Open bool
}
// CodeLine is één regel broncode.
@@ -687,6 +687,9 @@ type FileRow struct { Dir bool Dir bool Depth int Depth int Active bool Active bool // Open geldt voor een map die het huidige pad bevat. De browser // onthoudt afwijkingen daarvan per repository. Open bool}}// CodeLine is één regel broncode.// CodeLine is één regel broncode.@@ -541,6 +541,10 @@ func TestProjectOverviewAndFiles(t *testing.T) {
`data-tree-filter`,
`data-path="src/main.go"`,
`data-path="crates/sim"`,
`data-repo="tim/legacy-cycles"`,
`class="filepane"`,
`class="twist"`,
`aria-expanded="false"`,
"This directory is empty.",
} {
if want == "This directory is empty." {
@@ -553,6 +557,9 @@ func TestProjectOverviewAndFiles(t *testing.T) {
t.Fatalf("bestanden mist %q\n%s", want, tree)
}
}
if strings.Contains(tree, `aria-expanded="true"`) || strings.Contains(tree, ` dir open`) {
t.Fatalf("root hoort dichtgeklapt:\n%s", tree)
}
res, err = client.Get(ts.URL + "/tim/legacy-cycles/-/blob/src/main.go")
if err != nil {
@@ -562,7 +569,13 @@ func TestProjectOverviewAndFiles(t *testing.T) {
for _, want := range []string{
`class="on">Files`,
`class="depth-1 active"`,
`class="depth-0 dir open active"`,
`data-dir="1"`,
`aria-expanded="true"`,
`data-path="src"`,
`data-repo="tim/legacy-cycles"`,
`class="filepane"`,
`class="chevron"`,
`<span class="hl-k">func</span>`,
`<span class="hl-s">"fmt"</span>`,
`class="ln">1`,
@@ -541,6 +541,10 @@ func TestProjectOverviewAndFiles(t *testing.T) { `data-tree-filter`, `data-tree-filter`, `data-path="src/main.go"`, `data-path="src/main.go"`, `data-path="crates/sim"`, `data-path="crates/sim"`, `data-repo="tim/legacy-cycles"`, `class="filepane"`, `class="twist"`, `aria-expanded="false"`, "This directory is empty.", "This directory is empty.", } { } { if want == "This directory is empty." { if want == "This directory is empty." {@@ -553,6 +557,9 @@ func TestProjectOverviewAndFiles(t *testing.T) { t.Fatalf("bestanden mist %q\n%s", want, tree) t.Fatalf("bestanden mist %q\n%s", want, tree) } } } } if strings.Contains(tree, `aria-expanded="true"`) || strings.Contains(tree, ` dir open`) { t.Fatalf("root hoort dichtgeklapt:\n%s", tree) } res, err = client.Get(ts.URL + "/tim/legacy-cycles/-/blob/src/main.go") res, err = client.Get(ts.URL + "/tim/legacy-cycles/-/blob/src/main.go") if err != nil { if err != nil {@@ -562,7 +569,13 @@ func TestProjectOverviewAndFiles(t *testing.T) { for _, want := range []string{ for _, want := range []string{ `class="on">Files`, `class="on">Files`, `class="depth-1 active"`, `class="depth-1 active"`, `class="depth-0 dir open active"`, `data-dir="1"`, `aria-expanded="true"`, `data-path="src"`, `data-path="src"`, `data-repo="tim/legacy-cycles"`, `class="filepane"`, `class="chevron"`, `<span class="hl-k">func</span>`, `<span class="hl-k">func</span>`, `<span class="hl-s">"fmt"</span>`, `<span class="hl-s">"fmt"</span>`, `class="ln">1`, `class="ln">1`,@@ -7,37 +7,146 @@
});
});
var filter = document.querySelector("[data-tree-filter]");
if (filter) {
var items = document.querySelectorAll(".treelist li");
filter.addEventListener("input", function () {
var q = filter.value.trim().toLowerCase();
var list = document.querySelector(".treelist");
if (list) {
var repo = list.getAttribute("data-repo") || "";
var key = "bluegit.tree." + repo;
var saved = {};
try {
var raw = JSON.parse(localStorage.getItem(key) || "{}");
if (raw && typeof raw === "object") {
saved = raw;
}
} catch (e) {
saved = {};
}
function parentOf(path) {
var i = path.lastIndexOf("/");
return i < 0 ? "" : path.slice(0, i);
}
var force = {};
var active = null;
list.querySelectorAll("li.active").forEach(function (li) {
var path = li.getAttribute("data-path") || "";
if (!active || path.length > (active.getAttribute("data-path") || "").length) {
active = li;
}
});
if (active) {
var activePath = active.getAttribute("data-path") || "";
if (active.getAttribute("data-dir") === "1") {
force[activePath] = true;
}
var anc = parentOf(activePath);
while (anc) {
force[anc] = true;
anc = parentOf(anc);
}
}
function isOpen(path, li) {
if (force[path]) {
return true;
}
if (Object.prototype.hasOwnProperty.call(saved, path)) {
return !!saved[path];
}
return li.classList.contains("open");
}
function paint() {
var items = list.querySelectorAll("li");
var byPath = {};
var paths = [];
items.forEach(function (li) {
paths.push((li.getAttribute("data-path") || "").toLowerCase());
var path = li.getAttribute("data-path") || "";
byPath[path] = li;
paths.push(path.toLowerCase());
if (li.getAttribute("data-dir") === "1") {
var open = isOpen(path, li);
li.classList.toggle("open", open);
var btn = li.querySelector("button.twist");
if (btn) {
btn.setAttribute("aria-expanded", open ? "true" : "false");
}
}
});
var q = filter ? filter.value.trim().toLowerCase() : "";
items.forEach(function (li, i) {
if (q === "") {
li.hidden = false;
return;
}
var path = paths[i];
if (path.indexOf(q) !== -1) {
li.hidden = false;
var path = li.getAttribute("data-path") || "";
var low = paths[i];
if (q !== "") {
if (low.indexOf(q) !== -1) {
li.hidden = false;
return;
}
var prefix = low + "/";
var child = false;
for (var j = 0; j < paths.length; j++) {
if (paths[j].indexOf(prefix) === 0 && paths[j].indexOf(q) !== -1) {
child = true;
break;
}
}
li.hidden = !child;
return;
}
var prefix = path + "/";
var child = false;
for (var j = 0; j < paths.length; j++) {
if (paths[j].indexOf(prefix) === 0 && paths[j].indexOf(q) !== -1) {
child = true;
var hidden = false;
var up = parentOf(path);
while (up) {
var node = byPath[up];
if (node && node.getAttribute("data-dir") === "1" && !node.classList.contains("open")) {
hidden = true;
break;
}
up = parentOf(up);
}
li.hidden = !child;
li.hidden = hidden;
});
}
function remember(path, open) {
delete force[path];
saved[path] = open;
try {
localStorage.setItem(key, JSON.stringify(saved));
} catch (e) {}
paint();
}
list.addEventListener("click", function (ev) {
var li = ev.target.closest("li");
if (!li || !list.contains(li) || li.getAttribute("data-dir") !== "1") {
return;
}
var link = ev.target.closest("a");
if (link && li.contains(link) && (ev.metaKey || ev.ctrlKey || ev.shiftKey || ev.altKey)) {
return;
}
ev.preventDefault();
var path = li.getAttribute("data-path") || "";
remember(path, !li.classList.contains("open"));
});
if (filter) {
filter.addEventListener("input", paint);
if (new URLSearchParams(window.location.search).get("focus") === "1") {
filter.focus();
}
}
paint();
var shown = null;
list.querySelectorAll("li.active").forEach(function (li) {
if (li.hidden) {
return;
}
if (!shown || (li.getAttribute("data-path") || "").length > (shown.getAttribute("data-path") || "").length) {
shown = li;
}
});
if (new URLSearchParams(window.location.search).get("focus") === "1") {
filter.focus();
if (shown) {
var top = shown.offsetTop;
var bottom = top + shown.offsetHeight;
if (top < list.scrollTop) {
list.scrollTop = top;
} else if (bottom > list.scrollTop + list.clientHeight) {
list.scrollTop = bottom - list.clientHeight;
}
}
}
})();
@@ -7,37 +7,146 @@ }); }); }); }); var filter = document.querySelector("[data-tree-filter]"); var filter = document.querySelector("[data-tree-filter]"); if (filter) { var list = document.querySelector(".treelist"); var items = document.querySelectorAll(".treelist li"); if (list) { filter.addEventListener("input", function () { var repo = list.getAttribute("data-repo") || ""; var q = filter.value.trim().toLowerCase(); var key = "bluegit.tree." + repo; var saved = {}; try { var raw = JSON.parse(localStorage.getItem(key) || "{}"); if (raw && typeof raw === "object") { saved = raw; } } catch (e) { saved = {}; } function parentOf(path) { var i = path.lastIndexOf("/"); return i < 0 ? "" : path.slice(0, i); } var force = {}; var active = null; list.querySelectorAll("li.active").forEach(function (li) { var path = li.getAttribute("data-path") || ""; if (!active || path.length > (active.getAttribute("data-path") || "").length) { active = li; } }); if (active) { var activePath = active.getAttribute("data-path") || ""; if (active.getAttribute("data-dir") === "1") { force[activePath] = true; } var anc = parentOf(activePath); while (anc) { force[anc] = true; anc = parentOf(anc); } } function isOpen(path, li) { if (force[path]) { return true; } if (Object.prototype.hasOwnProperty.call(saved, path)) { return !!saved[path]; } return li.classList.contains("open"); } function paint() { var items = list.querySelectorAll("li"); var byPath = {}; var paths = []; var paths = []; items.forEach(function (li) { items.forEach(function (li) { paths.push((li.getAttribute("data-path") || "").toLowerCase()); var path = li.getAttribute("data-path") || ""; byPath[path] = li; paths.push(path.toLowerCase()); if (li.getAttribute("data-dir") === "1") { var open = isOpen(path, li); li.classList.toggle("open", open); var btn = li.querySelector("button.twist"); if (btn) { btn.setAttribute("aria-expanded", open ? "true" : "false"); } } }); }); var q = filter ? filter.value.trim().toLowerCase() : ""; items.forEach(function (li, i) { items.forEach(function (li, i) { if (q === "") { var path = li.getAttribute("data-path") || ""; li.hidden = false; var low = paths[i]; return; if (q !== "") { } if (low.indexOf(q) !== -1) { var path = paths[i]; li.hidden = false; if (path.indexOf(q) !== -1) { return; li.hidden = false; } var prefix = low + "/"; var child = false; for (var j = 0; j < paths.length; j++) { if (paths[j].indexOf(prefix) === 0 && paths[j].indexOf(q) !== -1) { child = true; break; } } li.hidden = !child; return; return; } } var prefix = path + "/"; var hidden = false; var child = false; var up = parentOf(path); for (var j = 0; j < paths.length; j++) { while (up) { if (paths[j].indexOf(prefix) === 0 && paths[j].indexOf(q) !== -1) { var node = byPath[up]; child = true; if (node && node.getAttribute("data-dir") === "1" && !node.classList.contains("open")) { hidden = true; break; break; } } up = parentOf(up); } } li.hidden = !child; li.hidden = hidden; }); }); } function remember(path, open) { delete force[path]; saved[path] = open; try { localStorage.setItem(key, JSON.stringify(saved)); } catch (e) {} paint(); } list.addEventListener("click", function (ev) { var li = ev.target.closest("li"); if (!li || !list.contains(li) || li.getAttribute("data-dir") !== "1") { return; } var link = ev.target.closest("a"); if (link && li.contains(link) && (ev.metaKey || ev.ctrlKey || ev.shiftKey || ev.altKey)) { return; } ev.preventDefault(); var path = li.getAttribute("data-path") || ""; remember(path, !li.classList.contains("open")); }); if (filter) { filter.addEventListener("input", paint); if (new URLSearchParams(window.location.search).get("focus") === "1") { filter.focus(); } } paint(); var shown = null; list.querySelectorAll("li.active").forEach(function (li) { if (li.hidden) { return; } if (!shown || (li.getAttribute("data-path") || "").length > (shown.getAttribute("data-path") || "").length) { shown = li; } }); }); if (new URLSearchParams(window.location.search).get("focus") === "1") { if (shown) { filter.focus(); var top = shown.offsetTop; var bottom = top + shown.offsetHeight; if (top < list.scrollTop) { list.scrollTop = top; } else if (bottom > list.scrollTop + list.clientHeight) { list.scrollTop = bottom - list.clientHeight; } } } } }})();})();@@ -277,20 +277,46 @@ table.md th, table.md td { border: 1px solid var(--line); padding: 0.4rem 0.6rem
.counts { list-style: none; padding: 0; margin: 0.6rem 0; }
.counts li { padding: 0.28rem 0; }
.counts a { text-decoration: none; }
.fileview { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 1rem; align-items: start; }
.treebox h2 { margin: 0 0 0.5rem; font-size: 1.15rem; }
.treelist { list-style: none; padding: 0; margin: 0.5rem 0 0; }
.treelist li { padding: 0.18rem 0.3rem; border-radius: 6px; white-space: nowrap; }
.treelist li a { color: inherit; text-decoration: none; }
.fileview {
display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 1rem; align-items: stretch;
/* topbalk, padding van main, kruimels en paginatitel */
height: calc(100vh - var(--top-h) - 8.25rem); min-height: 18rem;
}
.treebox { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.treebox h2 { margin: 0 0 0.5rem; font-size: 1.15rem; flex: none; }
.treebox > input { flex: none; }
.treelist {
list-style: none; padding: 0; margin: 0.5rem 0 0; position: relative;
flex: 1 1 auto; min-height: 0; overflow: auto;
}
.treelist li { display: flex; align-items: center; gap: 0.15rem; padding: 0.18rem 0.3rem; border-radius: 6px; white-space: nowrap; }
.treelist li[hidden] { display: none !important; }
.treelist li a { color: inherit; text-decoration: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.treelist li.active { background: #ddf4ff; }
.treelist .ficon { flex: none; }
.treelist button.twist, .treelist .twistpad {
width: 1rem; height: 1rem; flex: none;
}
.treelist button.twist {
background: transparent; color: var(--muted); border: 0; box-shadow: none;
min-height: 0; padding: 0; border-radius: 3px;
}
.treelist button.twist:hover { background: var(--blue-soft); color: var(--ink); }
.treelist button.twist:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.treelist .chevron { width: 0.7rem; height: 0.7rem; display: block; transition: transform 120ms ease; }
.treelist li.open > button.twist .chevron { transform: rotate(90deg); }
.treelist li.depth-1 { padding-left: 0.9rem; }
.treelist li.depth-2 { padding-left: 1.6rem; }
.treelist li.depth-3 { padding-left: 2.3rem; }
.treelist li.depth-4 { padding-left: 3rem; }
.treelist li.depth-5 { padding-left: 3.7rem; }
.treelist li.depth-6, .treelist li.depth-7, .treelist li.depth-8 { padding-left: 4.4rem; }
.filecol { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.filecol > .toolbar { flex: none; margin-top: 0; }
.filepane { flex: 1 1 auto; min-height: 0; overflow: auto; }
.filename { display: flex; align-items: center; gap: 0.35rem; margin: 0.2rem 0 0.6rem; }
.codebox { margin-top: 0.8rem; overflow: auto; }
.fileview .codebox { overflow: visible; }
table.code { border-collapse: collapse; width: 100%; }
table.code td { border: 0; padding: 0 0.7rem; vertical-align: top; font-family: ui-monospace, monospace; font-size: 0.86rem; line-height: 1.45; }
table.code td.ln { color: #8c959f; text-align: right; width: 1%; user-select: none; background: #f6f8fa; }
@@ -919,6 +945,10 @@ form.wh .grid-2 label { margin-top: 0; }
@media (max-width: 800px) {
.proj, .fileview, .joblayout { grid-template-columns: minmax(0, 1fr); }
.proj > *, .fileview > *, .toolbar, .commitbar, .hscroll { min-width: 0; max-width: 100%; }
.fileview { height: auto; min-height: 0; }
.fileview .treelist { max-height: 40vh; flex: none; }
.fileview .filepane { overflow: visible; }
.fileview .codebox { overflow: auto; }
.heat-foot { flex-direction: column; align-items: flex-start; }
.heat-legend, .heat-foot .muted { justify-content: flex-start; text-align: left; }
.repolist > li { flex-wrap: wrap; }
@@ -277,20 +277,46 @@ table.md th, table.md td { border: 1px solid var(--line); padding: 0.4rem 0.6rem.counts { list-style: none; padding: 0; margin: 0.6rem 0; }.counts { list-style: none; padding: 0; margin: 0.6rem 0; }.counts li { padding: 0.28rem 0; }.counts li { padding: 0.28rem 0; }.counts a { text-decoration: none; }.counts a { text-decoration: none; }.fileview { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 1rem; align-items: start; }.fileview {.treebox h2 { margin: 0 0 0.5rem; font-size: 1.15rem; } display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 1rem; align-items: stretch;.treelist { list-style: none; padding: 0; margin: 0.5rem 0 0; } /* topbalk, padding van main, kruimels en paginatitel */.treelist li { padding: 0.18rem 0.3rem; border-radius: 6px; white-space: nowrap; } height: calc(100vh - var(--top-h) - 8.25rem); min-height: 18rem;.treelist li a { color: inherit; text-decoration: none; }}.treebox { display: flex; flex-direction: column; min-width: 0; min-height: 0; }.treebox h2 { margin: 0 0 0.5rem; font-size: 1.15rem; flex: none; }.treebox > input { flex: none; }.treelist { list-style: none; padding: 0; margin: 0.5rem 0 0; position: relative; flex: 1 1 auto; min-height: 0; overflow: auto;}.treelist li { display: flex; align-items: center; gap: 0.15rem; padding: 0.18rem 0.3rem; border-radius: 6px; white-space: nowrap; }.treelist li[hidden] { display: none !important; }.treelist li a { color: inherit; text-decoration: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; }.treelist li.active { background: #ddf4ff; }.treelist li.active { background: #ddf4ff; }.treelist .ficon { flex: none; }.treelist button.twist, .treelist .twistpad { width: 1rem; height: 1rem; flex: none;}.treelist button.twist { background: transparent; color: var(--muted); border: 0; box-shadow: none; min-height: 0; padding: 0; border-radius: 3px;}.treelist button.twist:hover { background: var(--blue-soft); color: var(--ink); }.treelist button.twist:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }.treelist .chevron { width: 0.7rem; height: 0.7rem; display: block; transition: transform 120ms ease; }.treelist li.open > button.twist .chevron { transform: rotate(90deg); }.treelist li.depth-1 { padding-left: 0.9rem; }.treelist li.depth-1 { padding-left: 0.9rem; }.treelist li.depth-2 { padding-left: 1.6rem; }.treelist li.depth-2 { padding-left: 1.6rem; }.treelist li.depth-3 { padding-left: 2.3rem; }.treelist li.depth-3 { padding-left: 2.3rem; }.treelist li.depth-4 { padding-left: 3rem; }.treelist li.depth-4 { padding-left: 3rem; }.treelist li.depth-5 { padding-left: 3.7rem; }.treelist li.depth-5 { padding-left: 3.7rem; }.treelist li.depth-6, .treelist li.depth-7, .treelist li.depth-8 { padding-left: 4.4rem; }.treelist li.depth-6, .treelist li.depth-7, .treelist li.depth-8 { padding-left: 4.4rem; }.filecol { display: flex; flex-direction: column; min-width: 0; min-height: 0; }.filecol > .toolbar { flex: none; margin-top: 0; }.filepane { flex: 1 1 auto; min-height: 0; overflow: auto; }.filename { display: flex; align-items: center; gap: 0.35rem; margin: 0.2rem 0 0.6rem; }.filename { display: flex; align-items: center; gap: 0.35rem; margin: 0.2rem 0 0.6rem; }.codebox { margin-top: 0.8rem; overflow: auto; }.codebox { margin-top: 0.8rem; overflow: auto; }.fileview .codebox { overflow: visible; }table.code { border-collapse: collapse; width: 100%; }table.code { border-collapse: collapse; width: 100%; }table.code td { border: 0; padding: 0 0.7rem; vertical-align: top; font-family: ui-monospace, monospace; font-size: 0.86rem; line-height: 1.45; }table.code td { border: 0; padding: 0 0.7rem; vertical-align: top; font-family: ui-monospace, monospace; font-size: 0.86rem; line-height: 1.45; }table.code td.ln { color: #8c959f; text-align: right; width: 1%; user-select: none; background: #f6f8fa; }table.code td.ln { color: #8c959f; text-align: right; width: 1%; user-select: none; background: #f6f8fa; }@@ -919,6 +945,10 @@ form.wh .grid-2 label { margin-top: 0; }@media (max-width: 800px) {@media (max-width: 800px) { .proj, .fileview, .joblayout { grid-template-columns: minmax(0, 1fr); } .proj, .fileview, .joblayout { grid-template-columns: minmax(0, 1fr); } .proj > *, .fileview > *, .toolbar, .commitbar, .hscroll { min-width: 0; max-width: 100%; } .proj > *, .fileview > *, .toolbar, .commitbar, .hscroll { min-width: 0; max-width: 100%; } .fileview { height: auto; min-height: 0; } .fileview .treelist { max-height: 40vh; flex: none; } .fileview .filepane { overflow: visible; } .fileview .codebox { overflow: auto; } .heat-foot { flex-direction: column; align-items: flex-start; } .heat-foot { flex-direction: column; align-items: flex-start; } .heat-legend, .heat-foot .muted { justify-content: flex-start; text-align: left; } .heat-legend, .heat-foot .muted { justify-content: flex-start; text-align: left; } .repolist > li { flex-wrap: wrap; } .repolist > li { flex-wrap: wrap; }@@ -463,16 +463,17 @@
<aside class="treebox">
<h2>{{t "repo.files"}}</h2>
<input type="search" placeholder="{{t "group.search"}}" aria-label="{{t "group.search"}}" data-tree-filter>
<ul class="treelist">
<ul class="treelist" data-repo="{{.Repo.FullPath}}">
{{range .Tree}}
<li class="depth-{{.Depth}}{{if .Active}} active{{end}}" data-path="{{.Path}}">
<li class="depth-{{.Depth}}{{if .Dir}} dir{{end}}{{if .Open}} open{{end}}{{if .Active}} active{{end}}" data-path="{{.Path}}"{{if .Dir}} data-dir="1"{{end}}>
{{if .Dir}}<button type="button" class="twist" aria-expanded="{{if .Open}}true{{else}}false{{end}}" aria-label="{{t "repo.fold"}}"><svg class="chevron" viewBox="0 0 16 16" aria-hidden="true"><path d="M6 3.5 11 8 6 12.5" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg></button>{{else}}<span class="twistpad" aria-hidden="true"></span>{{end}}
{{template "ficon" .Icon}}
{{if .Dir}}<a href="/{{$.Repo.FullPath}}/-/tree/{{.Path}}?rev={{$.Rev}}">{{.Name}}</a>{{else}}<a href="/{{$.Repo.FullPath}}/-/blob/{{.Path}}?rev={{$.Rev}}">{{.Name}}</a>{{end}}
</li>
{{end}}
</ul>
</aside>
<div>
<div class="filecol">
<div class="toolbar">
<div class="left">
{{template "branchpick" .}}
@@ -484,6 +485,7 @@
</div>
<div class="right">{{template "codemenu" .}}</div>
</div>
<div class="filepane">
{{if .BlobPath}}
<h2 class="filename">{{template "ficon" (iconOf .FileName)}} {{.FileName}}</h2>
{{template "commitbar" .}}
@@ -498,6 +500,7 @@
{{else}}
{{template "filetable" .}}
{{end}}
</div>
</div>
</div>
<script src="/assets/repo.js"></script>
@@ -463,16 +463,17 @@ <aside class="treebox"> <aside class="treebox"> <h2>{{t "repo.files"}}</h2> <h2>{{t "repo.files"}}</h2> <input type="search" placeholder="{{t "group.search"}}" aria-label="{{t "group.search"}}" data-tree-filter> <input type="search" placeholder="{{t "group.search"}}" aria-label="{{t "group.search"}}" data-tree-filter> <ul class="treelist"> <ul class="treelist" data-repo="{{.Repo.FullPath}}"> {{range .Tree}} {{range .Tree}} <li class="depth-{{.Depth}}{{if .Active}} active{{end}}" data-path="{{.Path}}"> <li class="depth-{{.Depth}}{{if .Dir}} dir{{end}}{{if .Open}} open{{end}}{{if .Active}} active{{end}}" data-path="{{.Path}}"{{if .Dir}} data-dir="1"{{end}}> {{if .Dir}}<button type="button" class="twist" aria-expanded="{{if .Open}}true{{else}}false{{end}}" aria-label="{{t "repo.fold"}}"><svg class="chevron" viewBox="0 0 16 16" aria-hidden="true"><path d="M6 3.5 11 8 6 12.5" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg></button>{{else}}<span class="twistpad" aria-hidden="true"></span>{{end}} {{template "ficon" .Icon}} {{template "ficon" .Icon}} {{if .Dir}}<a href="/{{$.Repo.FullPath}}/-/tree/{{.Path}}?rev={{$.Rev}}">{{.Name}}</a>{{else}}<a href="/{{$.Repo.FullPath}}/-/blob/{{.Path}}?rev={{$.Rev}}">{{.Name}}</a>{{end}} {{if .Dir}}<a href="/{{$.Repo.FullPath}}/-/tree/{{.Path}}?rev={{$.Rev}}">{{.Name}}</a>{{else}}<a href="/{{$.Repo.FullPath}}/-/blob/{{.Path}}?rev={{$.Rev}}">{{.Name}}</a>{{end}} </li> </li> {{end}} {{end}} </ul> </ul> </aside> </aside> <div> <div class="filecol"> <div class="toolbar"> <div class="toolbar"> <div class="left"> <div class="left"> {{template "branchpick" .}} {{template "branchpick" .}}@@ -484,6 +485,7 @@ </div> </div> <div class="right">{{template "codemenu" .}}</div> <div class="right">{{template "codemenu" .}}</div> </div> </div> <div class="filepane"> {{if .BlobPath}} {{if .BlobPath}} <h2 class="filename">{{template "ficon" (iconOf .FileName)}} {{.FileName}}</h2> <h2 class="filename">{{template "ficon" (iconOf .FileName)}} {{.FileName}}</h2> {{template "commitbar" .}} {{template "commitbar" .}}@@ -498,6 +500,7 @@ {{else}} {{else}} {{template "filetable" .}} {{template "filetable" .}} {{end}} {{end}} </div> </div> </div></div></div><script src="/assets/repo.js"></script><script src="/assets/repo.js"></script>@@ -0,0 +1,60 @@
package server
import (
"testing"
"gitlab.com/Timfa/bluegit/internal/gitrepo"
)
func TestTreeRowsOpen(t *testing.T) {
entries := []gitrepo.Entry{
{Type: "tree", Name: "src"},
{Type: "tree", Name: "src/pkg"},
{Type: "blob", Name: "src/main.go"},
{Type: "blob", Name: "src/pkg/util.go"},
{Type: "tree", Name: "docs"},
{Type: "blob", Name: "docs/a.md"},
}
rows := treeRows(entries, "src/main.go")
by := map[string]FileRow{}
for _, r := range rows {
by[r.Path] = r
}
if !by["src"].Dir || !by["src"].Open || !by["src"].Active || by["src"].Depth != 0 {
t.Fatalf("src: %+v", by["src"])
}
if by["src/pkg"].Open || by["src/pkg"].Active || !by["src/pkg"].Dir {
t.Fatalf("src/pkg: %+v", by["src/pkg"])
}
if by["src/main.go"].Dir || by["src/main.go"].Open || !by["src/main.go"].Active || by["src/main.go"].Depth != 1 {
t.Fatalf("main: %+v", by["src/main.go"])
}
if by["docs"].Open || by["docs"].Active || !by["docs"].Dir {
t.Fatalf("docs: %+v", by["docs"])
}
if by["docs/a.md"].Active || by["docs/a.md"].Open {
t.Fatalf("a.md: %+v", by["docs/a.md"])
}
nested := treeRows(entries, "src/pkg/util.go")
open := map[string]bool{}
for _, r := range nested {
open[r.Path] = r.Open
if r.Path == "src/pkg/util.go" && (r.Dir || !r.Active || r.Open) {
t.Fatalf("util: %+v", r)
}
}
if !open["src"] || !open["src/pkg"] || open["docs"] {
t.Fatalf("voorouders: %v", open)
}
folder := treeRows(entries, "docs")
for _, r := range folder {
if r.Path == "docs" && (!r.Open || !r.Active) {
t.Fatalf("docs als huidige map: %+v", r)
}
if r.Path == "src" && r.Open {
t.Fatalf("src hoort dicht: %+v", r)
}
}
}
@@ -0,0 +1,60 @@package serverimport ( "testing" "gitlab.com/Timfa/bluegit/internal/gitrepo")func TestTreeRowsOpen(t *testing.T) { entries := []gitrepo.Entry{ {Type: "tree", Name: "src"}, {Type: "tree", Name: "src/pkg"}, {Type: "blob", Name: "src/main.go"}, {Type: "blob", Name: "src/pkg/util.go"}, {Type: "tree", Name: "docs"}, {Type: "blob", Name: "docs/a.md"}, } rows := treeRows(entries, "src/main.go") by := map[string]FileRow{} for _, r := range rows { by[r.Path] = r } if !by["src"].Dir || !by["src"].Open || !by["src"].Active || by["src"].Depth != 0 { t.Fatalf("src: %+v", by["src"]) } if by["src/pkg"].Open || by["src/pkg"].Active || !by["src/pkg"].Dir { t.Fatalf("src/pkg: %+v", by["src/pkg"]) } if by["src/main.go"].Dir || by["src/main.go"].Open || !by["src/main.go"].Active || by["src/main.go"].Depth != 1 { t.Fatalf("main: %+v", by["src/main.go"]) } if by["docs"].Open || by["docs"].Active || !by["docs"].Dir { t.Fatalf("docs: %+v", by["docs"]) } if by["docs/a.md"].Active || by["docs/a.md"].Open { t.Fatalf("a.md: %+v", by["docs/a.md"]) } nested := treeRows(entries, "src/pkg/util.go") open := map[string]bool{} for _, r := range nested { open[r.Path] = r.Open if r.Path == "src/pkg/util.go" && (r.Dir || !r.Active || r.Open) { t.Fatalf("util: %+v", r) } } if !open["src"] || !open["src/pkg"] || open["docs"] { t.Fatalf("voorouders: %v", open) } folder := treeRows(entries, "docs") for _, r := range folder { if r.Path == "docs" && (!r.Open || !r.Active) { t.Fatalf("docs als huidige map: %+v", r) } if r.Path == "src" && r.Open { t.Fatalf("src hoort dicht: %+v", r) } }}