Commit 4e1f977845cc6dc82a0db7aa624b546f5466240a

Authored by totoro
1 parent a55ca6d7

add a list of class in left menu

Showing 1 changed file with 26 additions and 13 deletions   Show diff stats
web/widgets/left_menu.anubis
@@ -8,15 +8,21 @@ @@ -8,15 +8,21 @@
8 8
9 transmit tools/basis.anubis 9 transmit tools/basis.anubis
10 read calexium_lib/web/CXM_making_a_web_site.anubis 10 read calexium_lib/web/CXM_making_a_web_site.anubis
11 - 11 +read system/string.anubis
12 12
13 public type Left_Menu_Entry: 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). 14 + left_menu_entry( //MENU entry hence no selectable
  15 + String entry_id, //it's also use as icon prefix
  16 + List(String) classes, //additional classes if need (for disabling entry, change background color, etc.)
  17 + String action, //action (url to apply when click
  18 + String text, //text to show
  19 + List((String, String)) extra //extra web arguments to send when click
  20 + ),
  21 + title( //TITLE entry hence no selectable
  22 + String title_id, //it's also use as icon prefix
  23 + List(String) classes, //additional classes if need (change background color, font size, etc.)
  24 + String text //text to show
  25 + ).
20 26
21 public type Left_Menu: 27 public type Left_Menu:
22 no_left_menu, 28 no_left_menu,
@@ -27,13 +33,20 @@ public type Left_Menu: @@ -27,13 +33,20 @@ public type Left_Menu:
27 public define Left_Menu_Entry 33 public define Left_Menu_Entry
28 left_menu_entry 34 left_menu_entry
29 ( 35 (
30 - String class, 36 + String entry_id,
31 String action, 37 String action,
32 String text 38 String text
33 )= 39 )=
34 - left_menu_entry(class, action, text, []) 40 + left_menu_entry(entry_id, [], action, text, [])
35 . 41 .
36 42
  43 +public define Left_Menu_Entry
  44 + title
  45 + (
  46 + String text
  47 + )=
  48 + title("", [], text).
  49 +
37 define List(HTML_Off_Form) 50 define List(HTML_Off_Form)
38 make_left_menu 51 make_left_menu
39 ( 52 (
@@ -49,10 +62,10 @@ define List(HTML_Off_Form) @@ -49,10 +62,10 @@ define List(HTML_Off_Form)
49 with entry = 62 with entry =
50 if h is 63 if h is
51 { 64 {
52 - left_menu_entry(_class, _action, _text, _extra) then  
53 - (HTML_Off_Form)paragraph([class("item "+_class+"_icon"+if _class=selected then " selected" else "")],actioner(same,same, link(_T(_text)),_action,_extra)),  
54 - title(_class, _text) then  
55 - (HTML_Off_Form)paragraph([class("menu_title"), class("item "+_class+"_icon"+if _class=selected then " selected" else "")], text([],_T(_text))) 65 + left_menu_entry(_menu_id, _classes, _action, _text, _extra) then
  66 + (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)),
  67 + title(_title_id, _classes, _text) then
  68 + (HTML_Off_Form)paragraph([class("menu_title"), class("item "+_title_id+"_icon"+if _title_id=selected then " selected" else ""+ " "+join(" ", _classes))], text([],_T(_text)))
56 }, 69 },
57 make_left_menu(_T, t, selected, [ entry . so_far]) 70 make_left_menu(_T, t, selected, [ entry . so_far])
58 }. 71 }.