Grotti 3.6.0: Lauf-Identität nach Filament-Pause, robustere Queue, Projekte/Aufträge list-first und API-Polish.
This commit is contained in:
1 parent
d1eb87ba25
commit
2b1e36634a
53 files changed
+4254
-636
No files matched your search
@@ -374,6 +374,56 @@ function renderPager(el, state, onPage) {
|
||||
el.querySelector(".pager-next").onclick = () => onPage(s.page + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Einheitliche Querverlinkung zwischen Seiten.
|
||||
* @param {"datei"|"projekt"|"spule"|"auftrag"|"lauf"|"drucker"} kind
|
||||
* @param {string|number} id
|
||||
* @param {string} [label]
|
||||
* @returns {string} HTML-Anker oder escaped Text
|
||||
*/
|
||||
function linkTo(kind, id, label) {
|
||||
const text = escapeHtml(label == null || label === "" ? String(id ?? "") : String(label));
|
||||
if (id == null || id === "") return text;
|
||||
const enc = encodeURIComponent(String(id));
|
||||
let href = "";
|
||||
switch (kind) {
|
||||
case "datei":
|
||||
href = "/dateien?file=" + enc;
|
||||
break;
|
||||
case "projekt":
|
||||
href = "/projekte#" + enc;
|
||||
break;
|
||||
case "spule":
|
||||
href = "/material?spule=" + enc;
|
||||
break;
|
||||
case "auftrag":
|
||||
href = "/auftraege#" + enc;
|
||||
break;
|
||||
case "lauf":
|
||||
href = "/protokoll/" + enc;
|
||||
break;
|
||||
case "drucker":
|
||||
href = "/#" + enc;
|
||||
break;
|
||||
default:
|
||||
return text;
|
||||
}
|
||||
return '<a href="' + href + '">' + text + "</a>";
|
||||
}
|
||||
|
||||
/** Hash/Query-Fokus: Element hervorheben und scrollen. */
|
||||
function focusById(id, opts) {
|
||||
if (!id) return null;
|
||||
const el = document.getElementById(id) || document.querySelector('[data-id="' + CSS.escape(String(id)) + '"]');
|
||||
if (!el) return null;
|
||||
el.classList.add("focus-flash");
|
||||
el.scrollIntoView({ behavior: (opts && opts.behavior) || "smooth", block: "center" });
|
||||
setTimeout(() => el.classList.remove("focus-flash"), 2400);
|
||||
return el;
|
||||
}
|
||||
|
||||
window.DEFAULT_PAGE_SIZE = DEFAULT_PAGE_SIZE;
|
||||
window.pageSlice = pageSlice;
|
||||
window.renderPager = renderPager;
|
||||
window.linkTo = linkTo;
|
||||
window.focusById = focusById;
|
||||
Reference in new issue
Block a user