sclass HMultiCRUD extends HAbstractRenderable { Concepts cc = db_mainConcepts(); L> classes; bool mutationRights, downloadRights = true; S mainTitle = "CRUD"; *(S *baseLink, Class... classes) { this(classes); } *(Class... classes) { this.classes = asList(classes); } S renderNavi() { ret p(joinWithVBar(naviComponents())); } LS naviComponents() { LS l = map(classes, c -> ahref(baseLinkPlus(shortName(c)), appendBracketedCountUnlessZero(countConcepts(cc, c), shortName(c)))); if (downloadRights) l.add(ahref(baseLinkPlus("download"), "download")); ret l; } O renderPage(S uri, SS params) { LS parts = tok_splitAtSlash_nempties(uri); S html = renderNavi() + renderMsgs(params); params = mapMinus(params, 'msg); Var title = new(mainTitle); if (nempty(parts)) { if (eq(parts, ll("download"))) { if (!downloadRights) ret "No download rights"; ret serveText(javaTokWordWrap(cc.xfullgrab())); } HCRUD crud = makeCRUD(first(parts)); if (crud != null) { crud.mutationRights = mutationRights; crud.baseLink = baseLinkPlus(first(parts)); crud.makeFrame = (title2, contents) -> { title.set(title! + " | " + title2); ret h3(title2) + contents; }; html += crud.renderPage(params); } } //ret "parts: " + sfu(parts); ret frame(title!, html); } selfType mutationRights(bool mutationRights) { this.mutationRights = mutationRights; this; } // override me HCRUD makeCRUD(S className) { null; } selfType mainTitle(S mainTitle) { this.mainTitle = mainTitle; this; } }