diff --git a/web/CXM_making_a_web_site.anubis b/web/CXM_making_a_web_site.anubis
index 1421ffa..72c48ca 100644
--- a/web/CXM_making_a_web_site.anubis
+++ b/web/CXM_making_a_web_site.anubis
@@ -1084,8 +1084,7 @@ public type Actioner_Aspect:
button (String url_off, String url_on, Int w, Int h), // idem with size
submit (List(CoreAttrs),String text),
immediate_selector (List(CoreAttrs),WebArgName name, Int size, List((List(CoreAttrs),WebArgValue,String)) choices, Maybe(InitialValue) selected, String onchange_fn),
-
- html (HTML_Off_Form).
+ html (List(CoreAttrs), HTML_Off_Form).
public define Actioner_Aspect
immediate_selector
@@ -1378,7 +1377,10 @@ public type HTML_In_Form:
ol (List(CoreAttrs), HTML_In_Form content),
ul (List(CoreAttrs), HTML_In_Form content),
li (List(CoreAttrs), HTML_In_Form content),
- button (List(CoreAttrs), HTML_In_Form content).
+ button (List(CoreAttrs), HTML_In_Form content),
+ i (List(CoreAttrs), String text),
+ span (List(CoreAttrs), String text)
+.
'HTML_In_Form' defines all the elements you may put within a form. We define a
@@ -1530,12 +1532,7 @@ public define HTML_In_Form
) =
private_download(abs_path,name,extra_ext,success((action_name,args))).
-public define HTML_In_Form
- text
- (
- String s
- ) =
- text([],s).
+
public define HTML_In_Form
text
@@ -1543,14 +1540,39 @@ public define HTML_In_Form
List(Text_Option) lto,
Int i
) =
- text(lto, to_decimal(i)).
+ text(lto, to_decimal(i)).
public define HTML_In_Form
text
(
+ String s
+ )=
+ text([],s)
+.
+
+public define HTML_In_Form
+ text
+ (
Int i
) =
- text([],i).
+ text([], i)
+.
+
+public define HTML_In_Form
+ span
+ (
+ String s
+ )=
+ span([],s)
+.
+
+public define HTML_In_Form
+ span
+ (
+ Int i
+ ) =
+ span([], to_decimal(i))
+.
public define HTML_In_Form
radio_button (List(CoreAttrs) options, HTML_Label label, WebArgName n, WebArgValue value, Bool checked)
@@ -1628,7 +1650,10 @@ public type HTML_Off_Form:
ol (List(CoreAttrs), HTML_Off_Form content),
ul (List(CoreAttrs), HTML_Off_Form content),
li (List(CoreAttrs), HTML_Off_Form content),
- button (List(CoreAttrs), HTML_Off_Form content).
+ button (List(CoreAttrs), HTML_Off_Form content),
+ i (List(CoreAttrs), String text),
+ span (List(CoreAttrs), String text)
+.
'HTML_Off_Form' defines all the elements you may put outside any form.
@@ -1828,19 +1853,39 @@ public define HTML_Off_Form
public define HTML_Off_Form
- text
- (
- Int i
- ) =
- text([],i).
+ text
+ (
+ Int i
+ )=
+ text([], i)
+.
public define HTML_Off_Form
text
(
String s
) =
- text([],s).
+ text([],s)
+.
+
+
+public define HTML_Off_Form
+ span
+ (
+ String s
+ )=
+ span([], s)
+.
+
+public define HTML_Off_Form
+ span
+ (
+ Int i
+ )=
+ span([], to_decimal(i))
+.
+
- Cell a gap between two other cells :
public define HTML_Cell(HTML_Off_Form)
@@ -3456,7 +3501,10 @@ type HTML_Any($T):
any_ol (List(CoreAttrs), $T content),
any_ul (List(CoreAttrs), $T content),
any_li (List(CoreAttrs), $T content),
- any_button (List(CoreAttrs), $T element).
+ any_button (List(CoreAttrs), $T element),
+ any_i (List(CoreAttrs), String text),
+ any_span (List(CoreAttrs), String text)
+.
@@ -4079,7 +4127,7 @@ define Maybe(String)
submit(opts,_) then extract_id(opts),
//immediate_selector(_,_,_,_) then failure,
immediate_selector(_,_,_,_,_,_) then failure,
- html(_) then failure,
+ html(_, _) then failure,
}.
to do Complete format_foreign_link
@@ -4139,9 +4187,9 @@ define Printable_tree
// [ ],
immediate_selector(opt,name,size,choices,selected,function) then
[ ],
- html(html_off_form) then
+ html(options, html_off_form) then
[
- "",
+ "",
format(cinfo, ic_v, html_off_form, is_https, action_count, head_tags),
""
]
@@ -4288,9 +4336,9 @@ define Printable_tree
"\" name=\"",name,"\" size=\"",size,"\"", format_attrs(options), ">",
if mb_selected is success(selected) then format_choices(choices, selected) else format_choices(choices),""
],
- html(html_off_form) then
+ html(options, html_off_form) then
[
- "",
+ "",
format(cinfo, ic_v, html_off_form, is_https, action_count, head_tags),
""
]
@@ -4857,6 +4905,13 @@ define Printable_tree
["
",format_element(e),"\n"],
any_button(options, e) then
[["\n"],
+ any_i(opts,t) then
+ if t = "" then
+ ["\n"]
+ else
+ ["",t,"\n"],
+ any_span(opts , t) then
+ ["",t,""]
}.
@@ -5084,7 +5139,11 @@ define Printable_tree
li(opts, t) then
format(cinfo,ic_v,any_li(opts,t),format_element,is_https, action_count, head_tags),
button(options, e) then
- format(cinfo,ic_v,any_button(options, e),format_element,is_https, action_count, head_tags),
+ format(cinfo,ic_v,any_button(options, e),format_element,is_https, action_count, head_tags),
+ i(opts, t) then
+ format(cinfo,ic_v,any_i(opts,t),format_element,is_https, action_count, head_tags),
+ span(opts,t) then
+ format(cinfo,ic_v,any_span(opts,t),format_element,is_https, action_count, head_tags)
}.
@@ -5172,8 +5231,11 @@ define Bool
ol(_,_) then false,
ul(_,_) then false,
li(_,_) then false,
- button(_,_) then false
- }.
+ button(_,_) then false,
+ i(_,_) then false,
+ span(_,_) then false
+ }
+.
define String
enctype
@@ -5312,6 +5374,10 @@ define Printable_tree
format(cinfo,ic_v,any_li(opts,t),format_element,is_https, action_count, head_tags),
button(options, e) then
format(cinfo, ic_v, any_button(options, e), format_element, is_https, action_count, head_tags),
+ i(opts, t) then
+ format(cinfo,ic_v,any_i(opts,t),format_element,is_https, action_count, head_tags),
+ span(opts,t) then
+ format(cinfo,ic_v,any_span(opts,t),format_element,is_https, action_count, head_tags),
}.
diff --git a/web/CXM_web_session.anubis b/web/CXM_web_session.anubis
index 8ce4e46..f645762 100644
--- a/web/CXM_web_session.anubis
+++ b/web/CXM_web_session.anubis
@@ -113,7 +113,7 @@ define List(WEB_Session_Field_No_Var)
public define WEB_Session
to_WEB_Session
- (
+ (
WEB_Session_No_Var _session
)=
since _session is web_session(language, fields, web_request, previous_web_request),
@@ -190,9 +190,9 @@ define One
{
[] then fields_org <- [session_field(_field_name, _field_type, var(_field_value)) . *fields_org],
[h . t] then
- println("h.field_name = "+h.field_name+" _field_name = "+_field_name);
+ //println("h.field_name = "+h.field_name+" _field_name = "+_field_name);
if h.field_name = _field_name & h.field_type = _field_type then
- println("replace field_name found");
+ //println("replace field_name found");
h.field_datum <- _field_value
else
replace_any(t, _field_type, _field_name, _field_value, fields_org)
diff --git a/web/fonts/awesome.anubis b/web/fonts/awesome.anubis
new file mode 100644
index 0000000..02586a7
--- /dev/null
+++ b/web/fonts/awesome.anubis
@@ -0,0 +1,24 @@
+/*
+ * Created by PyramIDE.
+ * User: フランスのトトロ aka (David RENÉ)
+ * Date: 23/02/2017
+ * Time: 21:43
+ * © Calexium
+ */
+
+read calexium_lib/web/CXM_making_a_web_site.anubis
+
+public type Font_Awesome:
+ awesome(
+ String code
+ )
+.
+
+public define HTML_Off_Form
+ to_HTML
+ (
+ Font_Awesome fa
+ )=
+ since fa is awesome(code),
+ i([class("fa fa-"+code), attr("aria-hidden", "true")],"")
+.
diff --git a/web/widgets/icon.anubis b/web/widgets/icon.anubis
new file mode 100644
index 0000000..18c8e57
--- /dev/null
+++ b/web/widgets/icon.anubis
@@ -0,0 +1,41 @@
+/*
+ * Created by PyramIDE.
+ * User: フランスのトトロ aka (David RENÉ)
+ * Date: 23/02/2017
+ * Time: 21:49
+ * © Calexium
+ */
+
+transmit calexium_lib/web/fonts/awesome.anubis
+read calexium_lib/web/CXM_making_a_web_site.anubis
+
+public type Icon:
+ no_icon,
+ font_awesome(
+ Font_Awesome fa
+ ),
+ icon16(
+ String name
+ ),
+ icon32(
+ String name
+ ),
+ icon(
+ String name
+ )
+.
+
+public define HTML_Off_Form
+ to_HTML
+ (
+ Icon icon
+ )=
+ if icon is
+ {
+ no_icon then empty,
+ font_awesome(code) then to_HTML(code),
+ icon16(name) then todo "handle case 'icon16'",
+ icon32(name) then todo "handle case 'icon32'",
+ icon(name) then todo "handle case 'icon'"
+ }
+.
diff --git a/web/widgets/menu.anubis b/web/widgets/menu.anubis
new file mode 100644
index 0000000..5b1af16
--- /dev/null
+++ b/web/widgets/menu.anubis
@@ -0,0 +1,231 @@
+/*
+ * Created by PyramIDE.
+ * User: フランスのトトロ aka (David RENÉ)
+ * Date: 18/02/2017
+ * Time: 01:52
+ * © Calexium
+ */
+
+
+transmit tools/basis.anubis
+read system/string.anubis
+
+read calexium_lib/web/CXM_making_a_web_site.anubis
+transmit calexium_lib/web/widgets/icon.anubis
+
+public type Menu_Item:
+ menu_item( //MENU entry
+ String text, //text to show
+ Icon icon,
+ List(String) ids, //it's also use as icon prefix
+ List(String) classes, //additional classes if need (for disabling entry, change background color, etc.)
+ WEB_Action_Name action, //action (url to apply when click
+ List((String, String)) extra, //extra web arguments to send when click
+ Actioner_Target target, //target if need
+ List(Menu_Item) sub_menu
+ //Bool selected
+ ),
+// menu_title( //TITLE entry hence no selectable
+// String text, //text to show
+// List(String) ids, //it's also use as icon prefix
+// List(String) classes //additional classes if need (change background color, font size, etc.)
+// ),
+ menu_item_content(
+ HTML_Partial_Content content
+ ),
+ menu_separator
+.
+
+public type Menu:
+ no_menu,
+ menu(
+ List(Menu_Item) items
+ //String selected
+ )
+.
+
+public define Menu_Item
+ menu_item
+ (
+ String text,
+ WEB_Action_Name action,
+ List((String, String)) extra_op
+ )=
+ menu_item(text, no_icon, [], [], action, extra_op, same, [])
+.
+
+public define Menu_Item
+ menu_item
+ (
+ String text,
+ Icon icon,
+ WEB_Action_Name action,
+ List((String, String)) extra_op
+ )=
+ menu_item(text, icon, [], [], action, extra_op, same, [])
+.
+
+public define Menu_Item
+ menu_item
+ (
+ String text,
+ WEB_Action_Name action
+ )=
+ menu_item(text, no_icon, [], [], action, [], same, [])
+.
+
+public define Menu_Item
+ menu_item
+ (
+ String text,
+ Icon icon,
+ WEB_Action_Name action
+ )=
+ menu_item(text, icon, [], [], action, [], same, [])
+.
+
+public define Menu_Item
+ menu_item
+ (
+ String text,
+ WEB_Action_Name action,
+ List(Menu_Item) sub_menu
+ )=
+ menu_item(text, no_icon, [], [], action, [], same, sub_menu)
+.
+
+public define Menu_Item
+ menu_item
+ (
+ String text,
+ Icon icon,
+ WEB_Action_Name action,
+ List(Menu_Item) sub_menu
+ )=
+ menu_item(text, icon, [], [], action, [], same, sub_menu)
+.
+
+//public define Nav_Menu_Entry
+// nav_menu_entry
+// (
+// String entry_id, //it's also use as icon prefix
+// WEB_Action_Name action, //action (url to apply when click
+// String text, //text to show
+// List((String, String)) extra //extra web arguments to send when click
+// )=
+// left_menu_entry(entry_id, [], action, text, extra)
+// .
+
+//public define Menu_Item
+// menu_title
+// (
+// String text
+// )=
+// menu_title(text, [], []).
+//
+//public define Menu_Item
+// menu_title
+// (
+// String text,
+// List(String) title_ids,
+// )=
+// menu_title(text, title_ids, []).
+
+define List(HTML_Off_Form)
+ generate_menu
+ (
+ (String) -> String _T, //translator function
+ List(Menu_Item) items,
+ List(HTML_Off_Form) so_far,
+ Int level
+ )=
+ if items is
+ {
+ [] then reverse(so_far), //reverse to be in the right direction
+ [_item . t] then
+ if _item is
+ {
+ //menu_item then generate_hk_menu(_T, t, so_far, level),
+ //li
+ menu_item(_text, _icon, _ids, _classes, _action, _extra, _target, _sub_menu) then
+ with classes = join(" ",[(if level = 0 then "maintab" else ""),
+ (if is_empty(_sub_menu) then "" else "has_submenu") .
+ _classes]),
+ with current_li = (HTML_Off_Form)li( [class(classes)],
+ //if _icon = "" then [] else [class(_icon+"_icon")],
+ sequence([actioner(same, _target,
+ html(if level = 0 then [class("title")] else [],
+ sequence([
+ //format the icon if need
+ to_HTML(_icon),
+ //format the text if need
+ if _text = "" then empty else span(_T(_text)), /*link(help_string(_text, _T))*/
+ //span(1),
+ ])),
+
+ _action,_extra
+ ),
+
+ if is_empty(_sub_menu) then
+ empty
+ else
+ (HTML_Off_Form)ul([class("submenu")], sequence(generate_menu(_T, _sub_menu, [], level+1)))
+ ])),
+ generate_menu(_T, t, [current_li . so_far], level),
+
+// menu_title(text, _ids, _classes) then
+ menu_item_content(_content) then
+// with current_li = (HTML_Off_Form)li([class("item "+_class+"_icon")],actioner(same,same, link(_T(_text)),_action,_extra)),
+ with current_li = (HTML_Off_Form)li([],partial(_content)),
+ generate_menu(_T, t, [current_li . so_far], level),
+ menu_separator then
+ with current_li = (HTML_Off_Form)li([],text("--- SEPARATOR ---")),
+ generate_menu(_T, t, [current_li . so_far], level)
+
+ }
+ }
+.
+// //ul
+//
+// hk_menu_list(_class, _action, _text, _extra, _entries) then
+// with current_li =
+// (HTML_Off_Form)li([class(_class+"_icon")],
+// sequence([
+//// actioner(same,same, link(_T(_text)),_action,_extra),
+// actioner(same,same, link(help_string(_text, _T)),_action,_extra),
+// text([class(if level = 0 then "dropBottom" else "dropRight")], ""),
+// (HTML_Off_Form)ul([], sequence(generate_hk_menu(_T, _entries, [], level+1)))])),
+// generate_hk_menu(_T, t, [current_li . so_far], level)
+//
+// }
+// }.
+
+
+define List(HTML_Off_Form)
+ make_menu
+ (
+ (String) -> String _T, //translator function
+ List(Menu_Item) menu_items,
+ String direction
+ )=
+ [literal("")].
+
+public define HTML_Partial_Content
+ make_menu
+ (
+ (String) -> String _T, //translator function
+ Menu _menu,
+ String _direction
+ )=
+ if _menu is
+ {
+ no_menu then partial_content(empty),
+ menu(items) then
+ partial_content([css(css_file("/css/cxm/cxm_menu.css"))],
+ //partial_content([css(css_file("/css/admin_theme.css"))],
+ sequence(make_menu(_T, items, _direction)))
+ }.
+
--
libgit2 0.21.4