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<OpenerTextConfig> 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); } }
Began life as a copy of #1028517
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
Snippet ID: | #1030268 |
Snippet name: | OpenerText [text beside chat bot opener icon, Include] |
Eternal ID of this version: | #1030268/4 |
Text MD5: | e2e94a6558814d69e735299d95f53fd3 |
Author: | stefan |
Category: | javax / web chat bot |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-11-27 18:54:22 |
Source code size: | 1537 bytes / 49 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 283 / 331 |
Version history: | 3 change(s) |
Referenced in: | -