SHARE
TWEET

Untitled

a guest Jun 19th, 2017 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -module (index).
  2. -compile(export_all).
  3. -include_lib("nitrogen/include/wf.hrl").
  4.  
  5. main() -> #template { file="./site/templates/bare.html" }.
  6.  
  7. title() -> "Welcome to Nitrogen".
  8.  
  9. body() ->
  10.         Data = [{"apple"},{"orange"},{"banana"},{"pear"}],
  11.         Map = {fruit@value},
  12.         [
  13.                 #bind{
  14.                         data=Data,
  15.                         map=Map,
  16.                         transform=fun({Fruitname},Acc) ->
  17.                                 {{Fruitname},Acc,{fruitname@text,Fruitname}}
  18.                         end,
  19.                         body=[
  20.                                 #checkbox{id=fruit},
  21.                                 #label{id=fruitname},
  22.                                 #br{}
  23.                         ]
  24.                 },
  25.                 #button{text="Submit",postback=checks}
  26.         ].
  27.  
  28.  
  29. event(checks) ->
  30.         Selected = wf:qs(fruit),
  31.         wf:wire(#alert{text=lists:concat(Selected)}).
RAW Paste Data
Pastebin PRO Summer Special!
Get 40% OFF on Pastebin PRO accounts!
Top