Commit ad8efe02e299a61a4b65f236387b3bda7714dc43
1 parent
4d677a68
Add left_menu.anubis widget. For historical reason it's named left_menu but it c…
…an be use to manage menu entry.
Showing
1 changed file
with
48 additions
and
0 deletions
Show diff stats
| 1 | +/* | ||
| 2 | + * Created by PyramIDE. | ||
| 3 | + * User: フランスのトトロ | ||
| 4 | + * Date: 10/01/2016 | ||
| 5 | + * Time: 12:24 | ||
| 6 | + * © Calexium | ||
| 7 | + */ | ||
| 8 | + | ||
| 9 | +transmit tools/basis.anubis | ||
| 10 | +read calexium_lib/web/CXM_making_a_web_site.anubis | ||
| 11 | + | ||
| 12 | + | ||
| 13 | +public type Left_Menu_Entry: | ||
| 14 | + left_menu_entry( | ||
| 15 | + String class, | ||
| 16 | + String action, | ||
| 17 | + String text, | ||
| 18 | + List((String, String)) extra), | ||
| 19 | + title(String class, String text). | ||
| 20 | + | ||
| 21 | +public type Left_Menu: | ||
| 22 | + no_left_menu, | ||
| 23 | + left_menu( | ||
| 24 | + List(Left_Menu_Entry) entries, | ||
| 25 | + String selected). | ||
| 26 | + | ||
| 27 | +public define List(HTML_Off_Form) | ||
| 28 | + make_left_menu | ||
| 29 | + ( | ||
| 30 | + (String) -> String _T, //translator function | ||
| 31 | + List(Left_Menu_Entry) entries, | ||
| 32 | + String selected, | ||
| 33 | + List(HTML_Off_Form) so_far | ||
| 34 | + )= | ||
| 35 | + if entries is | ||
| 36 | + { | ||
| 37 | + [] then reverse(so_far), //reverse to be in the right direction | ||
| 38 | + [h . t] then | ||
| 39 | + with entry = | ||
| 40 | + if h is | ||
| 41 | + { | ||
| 42 | + left_menu_entry(_class, _action, _text, _extra) then | ||
| 43 | + (HTML_Off_Form)paragraph([class("item "+_class+"_icon"+if _class=selected then " selected" else "")],actioner(same,same, link(_T(_text)),_action,_extra)), | ||
| 44 | + title(_class, _text) then | ||
| 45 | + (HTML_Off_Form)paragraph([class("menu_title"), class("item "+_class+"_icon"+if _class=selected then " selected" else "")], text([],_T(_text))) | ||
| 46 | + }, | ||
| 47 | + make_left_menu(_T, t, selected, [ entry . so_far]) | ||
| 48 | + }. |