From 4e1f977845cc6dc82a0db7aa624b546f5466240a Mon Sep 17 00:00:00 2001 From: totoro Date: Thu, 31 Mar 2016 16:37:53 +0200 Subject: [PATCH] add a list of class in left menu --- web/widgets/left_menu.anubis | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/web/widgets/left_menu.anubis b/web/widgets/left_menu.anubis index 2b5fef3..3905cbb 100644 --- a/web/widgets/left_menu.anubis +++ b/web/widgets/left_menu.anubis @@ -8,15 +8,21 @@ transmit tools/basis.anubis read calexium_lib/web/CXM_making_a_web_site.anubis - +read system/string.anubis public type Left_Menu_Entry: - left_menu_entry( - String class, - String action, - String text, - List((String, String)) extra), - title(String class, String text). + left_menu_entry( //MENU entry hence no selectable + String entry_id, //it's also use as icon prefix + List(String) classes, //additional classes if need (for disabling entry, change background color, etc.) + String action, //action (url to apply when click + String text, //text to show + List((String, String)) extra //extra web arguments to send when click + ), + title( //TITLE entry hence no selectable + String title_id, //it's also use as icon prefix + List(String) classes, //additional classes if need (change background color, font size, etc.) + String text //text to show + ). public type Left_Menu: no_left_menu, @@ -27,13 +33,20 @@ public type Left_Menu: public define Left_Menu_Entry left_menu_entry ( - String class, + String entry_id, String action, String text )= - left_menu_entry(class, action, text, []) + left_menu_entry(entry_id, [], action, text, []) . +public define Left_Menu_Entry + title + ( + String text + )= + title("", [], text). + define List(HTML_Off_Form) make_left_menu ( @@ -49,10 +62,10 @@ define List(HTML_Off_Form) 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))) + left_menu_entry(_menu_id, _classes, _action, _text, _extra) then + (HTML_Off_Form)paragraph([class("item "+_menu_id+"_icon"+if _menu_id=selected then " selected" else ""+ " "+join(" ", _classes))],actioner(same,same, link(_T(_text)),_action,_extra)), + title(_title_id, _classes, _text) then + (HTML_Off_Form)paragraph([class("menu_title"), class("item "+_title_id+"_icon"+if _title_id=selected then " selected" else ""+ " "+join(" ", _classes))], text([],_T(_text))) }, make_left_menu(_T, t, selected, [ entry . so_far]) }. -- libgit2 0.21.4