Libraryless. Click here for Pure Java version (7844L/51K).
1 | abstract sclass HAbstractRenderable { |
2 | S baseLink = ""; |
3 | MakeFrame makeFrame = (title, contents) -> h1_title(title) + contents; |
4 | |
5 | sinterface MakeFrame { |
6 | S makeFrame(S title, S contents); |
7 | } |
8 | |
9 | *() {} |
10 | *(S *baseLink) {} |
11 | |
12 | HAbstractRenderable makeFrame(MakeFrame makeFrame) { |
13 | this.makeFrame = makeFrame; |
14 | this; |
15 | } |
16 | |
17 | S baseLinkPlus(S uri) { |
18 | ret nempty(uri) ? appendSlash(baseLink) + uri : baseLink; |
19 | } |
20 | |
21 | // title is in HTML |
22 | S frame(S title, S contents) { |
23 | ret makeFrame.makeFrame(title, contents); |
24 | } |
25 | |
26 | S refreshWithMsgs(S... msgs) { ret refreshWithMsgs(asList(msgs)); } |
27 | |
28 | S refreshWithMsgs(LS msgs, O... _) { |
29 | optPar S anchor; |
30 | optPar SS params; |
31 | ret hrefresh(addAnchorToURL(appendQueryToURL(baseLink, |
32 | mapPlus(params, msg := htmlEncode_nlToBr(lines_rtrim(msgs)))), anchor)); |
33 | } |
34 | |
35 | S renderMsgs(SS params) { |
36 | ret pUnlessEmpty(params.get("msg")); |
37 | } |
38 | } |
Began life as a copy of #1026001
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1026135 |
Snippet name: | HAbstractRenderable - HTML renderable base class |
Eternal ID of this version: | #1026135/11 |
Text MD5: | 5f2e3a34cb56fc1b5f981f6963be5dc1 |
Transpilation MD5: | 88ec3b0e726868f4673c73bf17c2518a |
Author: | stefan |
Category: | javax / html |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-04-08 16:59:12 |
Source code size: | 953 bytes / 38 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 297 / 694 |
Version history: | 10 change(s) |
Referenced in: | [show references] |