Commit d771e05777cc4bce9841d963bd597b0c25421fc8

Authored by totoro
1 parent 8b0a26ee

move make_left_menu from applications to libarary

add helper to construct left_menu_entry without web arg
Showing 1 changed file with 27 additions and 2 deletions   Show diff stats
web/widgets/left_menu.anubis
@@ -23,8 +23,18 @@ public type Left_Menu: @@ -23,8 +23,18 @@ public type Left_Menu:
23 left_menu( 23 left_menu(
24 List(Left_Menu_Entry) entries, 24 List(Left_Menu_Entry) entries,
25 String selected). 25 String selected).
26 -  
27 -public define List(HTML_Off_Form) 26 +
  27 +public define Left_Menu_Entry
  28 + left_menu_entry
  29 + (
  30 + String class,
  31 + String action,
  32 + String text
  33 + )=
  34 + left_menu_entry(class, action, text, [])
  35 + .
  36 +
  37 +define List(HTML_Off_Form)
28 make_left_menu 38 make_left_menu
29 ( 39 (
30 (String) -> String _T, //translator function 40 (String) -> String _T, //translator function
@@ -46,3 +56,18 @@ public define List(HTML_Off_Form) @@ -46,3 +56,18 @@ public define List(HTML_Off_Form)
46 }, 56 },
47 make_left_menu(_T, t, selected, [ entry . so_far]) 57 make_left_menu(_T, t, selected, [ entry . so_far])
48 }. 58 }.
  59 +
  60 +public define HTML_Partial_Content
  61 + make_left_menu
  62 + (
  63 + (String) -> String _T, //translator function
  64 + Left_Menu l_menu
  65 + )=
  66 + if l_menu is
  67 + {
  68 + no_left_menu then partial_content(empty),
  69 + left_menu(entries, selected) then
  70 + partial_content([css(css_file("/css/left_menu.css"))],
  71 + sequence(make_left_menu(_T, entries, selected, [])))
  72 + }.
  73 +