concept OpenerTextConfig { S text; S textForMobile; bool enabled; S spans() { if (!enabled) ret ""; S mob = or2_trim(textForMobile, text); ret span(text, class := "for-desk") + "\n" + span(mob, class := "for-mobile"); } } sclass OpenerText { sO html(S uri, SS params, AuthedDialogID auth) null { S uri2 = appendSlash(uri); bool requestAuthed = auth != null; if (startsWith(uri2, "/opener-text-admin/")) { if (!requestAuthed) ret serveAuthForm(params.get('uri)); ret serveAdmin(uri, params); } } sS serveAdmin(S uri, SS params) { uniq(OpenerTextConfig); S _nav = p(ahref(rawBotLink(dbBotID), "Main admin") + " | " + ahref(baseLink + "/opener-text-admin", "Opener text")); HCRUD_Concepts data = new HCRUD_Concepts<>(OpenerTextConfig); data.fieldHelp = litmap( text := [[Text to show beside chat bot opener icon (e.g. "Contact us")]], textForMobile := [[Text to show on mobile devices (or empty to use value from above)]], enabled := "Actually show the text" ); HCRUD crud = new(rawLink("opener-text-admin"), data) { S frame(S title, S contents) { ret hhtml(hhead_title_htmldecode(title) + hbody( hsansserif() + hcss_responstable() + _nav + h1(title) + contents)); } }; crud.singleton = true; crud.cmdsLeft = true; crud.tableClass = "responstable"; ret crud.renderPage(params); } }