From ad8efe02e299a61a4b65f236387b3bda7714dc43 Mon Sep 17 00:00:00 2001 From: totoro Date: Sun, 10 Jan 2016 12:39:08 +0100 Subject: [PATCH] Add left_menu.anubis widget. For historical reason it's named left_menu but it can be use to manage menu entry. --- web/widgets/left_menu.anubis | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+), 0 deletions(-) create mode 100644 web/widgets/left_menu.anubis diff --git a/web/widgets/left_menu.anubis b/web/widgets/left_menu.anubis new file mode 100644 index 0000000..5d1e611 --- /dev/null +++ b/web/widgets/left_menu.anubis @@ -0,0 +1,48 @@ +/* + * Created by PyramIDE. + * User: フランスのトトロ + * Date: 10/01/2016 + * Time: 12:24 + * © Calexium + */ + +transmit tools/basis.anubis +read calexium_lib/web/CXM_making_a_web_site.anubis + + +public type Left_Menu_Entry: + left_menu_entry( + String class, + String action, + String text, + List((String, String)) extra), + title(String class, String text). + +public type Left_Menu: + no_left_menu, + left_menu( + List(Left_Menu_Entry) entries, + String selected). + +public define List(HTML_Off_Form) + make_left_menu + ( + (String) -> String _T, //translator function + List(Left_Menu_Entry) entries, + String selected, + List(HTML_Off_Form) so_far + )= + if entries is + { + [] then reverse(so_far), //reverse to be in the right direction + [h . t] then + with entry = + if h is + { + left_menu_entry(_class, _action, _text, _extra) then + (HTML_Off_Form)paragraph([class("item "+_class+"_icon"+if _class=selected then " selected" else "")],actioner(same,same, link(_T(_text)),_action,_extra)), + title(_class, _text) then + (HTML_Off_Form)paragraph([class("menu_title"), class("item "+_class+"_icon"+if _class=selected then " selected" else "")], text([],_T(_text))) + }, + make_left_menu(_T, t, selected, [ entry . so_far]) + }. -- libgit2 0.21.4