Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

35
LINES

< > BotCompany Repo | #1026135 - HAbstractRenderable - HTML renderable base class

JavaX fragment (include) [tags: use-pretranspiled]

Transpiled version (6757L) is out of date.

abstract sclass HAbstractRenderable {
  S baseLink;
  MakeFrame makeFrame = (title, contents) -> h1_title(title) + contents;

  sinterface MakeFrame {
    S makeFrame(S title, S contents);
  }
  
  *() {}
  *(S *baseLink) {}
  
  HAbstractRenderable makeFrame(MakeFrame makeFrame) {
    this.makeFrame = makeFrame;
    this;
  }
  
  S baseLinkPlus(S uri) {
    ret nempty(uri) ? appendSlash(baseLink) + uri : baseLink;
  }
  
  // title is in HTML
  S frame(S title, S contents) {
    ret makeFrame.makeFrame(title, contents);
  }
  
  S refreshWithMsgs(S... msgs) { ret refreshWithMsgs(asList(msgs)); }
  
  S refreshWithMsgs(LS msgs) {
    ret hrefresh(appendQueryToURL(baseLink, msg := htmlEncode_nlToBr(lines_rtrim(msgs))));
  }
  
  S renderMsgs(SS params) {
    ret pUnlessEmpty(params.get("msg"));
  }
}

Author comment

Began life as a copy of #1026001

download  show line numbers  debug dex   

Travelled to 3 computer(s): bhatertpkbcr, mqqgnosmbjvj, tvejysmllsmz

No comments. add comment

Snippet ID: #1026135
Snippet name: HAbstractRenderable - HTML renderable base class
Eternal ID of this version: #1026135/7
Text MD5: 9703a4e5adf58101e0c42660447d1b86
Author: stefan
Category: javax / html
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-11-27 23:11:49
Source code size: 847 bytes / 35 lines
Pitched / IR pitched: No / No
Views / Downloads: 33 / 129
Version history: 6 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1026135 & http://1026135.tinybrain.de