Commit a55ca6d75b244084b73cdb26c763e064839853cf

Authored by Julien Verneuil
1 parent f5fc19a6

add "button" for HTML_Off_form and HTML_In_form

make "jquery_button_html" function produce a button element instead of a div so tab can be used to focus it and the enter key work when the button is in a form
web/CXM_making_a_web_site.anubis
@@ -1191,7 +1191,8 @@ public type HTML_In_Form: @@ -1191,7 +1191,8 @@ public type HTML_In_Form:
1191 progress (List(CoreAttrs), Int value, Int max), 1191 progress (List(CoreAttrs), Int value, Int max),
1192 ol (List(CoreAttrs), HTML_In_Form content), 1192 ol (List(CoreAttrs), HTML_In_Form content),
1193 ul (List(CoreAttrs), HTML_In_Form content), 1193 ul (List(CoreAttrs), HTML_In_Form content),
1194 - li (List(CoreAttrs), HTML_In_Form content). 1194 + li (List(CoreAttrs), HTML_In_Form content),
  1195 + button (List(CoreAttrs), HTML_In_Form content).
1195 1196
1196 1197
1197 'HTML_In_Form' defines all the elements you may put within a form. We define a 1198 'HTML_In_Form' defines all the elements you may put within a form. We define a
@@ -1388,7 +1389,8 @@ public type HTML_Off_Form: @@ -1388,7 +1389,8 @@ public type HTML_Off_Form:
1388 progress (List(CoreAttrs), Int value, Int max), 1389 progress (List(CoreAttrs), Int value, Int max),
1389 ol (List(CoreAttrs), HTML_Off_Form content), 1390 ol (List(CoreAttrs), HTML_Off_Form content),
1390 ul (List(CoreAttrs), HTML_Off_Form content), 1391 ul (List(CoreAttrs), HTML_Off_Form content),
1391 - li (List(CoreAttrs), HTML_Off_Form content). 1392 + li (List(CoreAttrs), HTML_Off_Form content),
  1393 + button (List(CoreAttrs), HTML_Off_Form content).
1392 1394
1393 'HTML_Off_Form' defines all the elements you may put outside any form. 1395 'HTML_Off_Form' defines all the elements you may put outside any form.
1394 1396
@@ -2818,7 +2820,8 @@ type HTML_Any($T): @@ -2818,7 +2820,8 @@ type HTML_Any($T):
2818 any_coreattrs (List(CoreAttrs)), 2820 any_coreattrs (List(CoreAttrs)),
2819 any_ol (List(CoreAttrs), $T content), 2821 any_ol (List(CoreAttrs), $T content),
2820 any_ul (List(CoreAttrs), $T content), 2822 any_ul (List(CoreAttrs), $T content),
2821 - any_li (List(CoreAttrs), $T content). 2823 + any_li (List(CoreAttrs), $T content),
  2824 + any_button (List(CoreAttrs), $T element).
2822 2825
2823 2826
2824 2827
@@ -4130,7 +4133,9 @@ define Printable_tree @@ -4130,7 +4133,9 @@ define Printable_tree
4130 any_ul(opts,e) then 4133 any_ul(opts,e) then
4131 ["<ul", format_attrs(opts), ">",format_element(e),"</ul>\n"], 4134 ["<ul", format_attrs(opts), ">",format_element(e),"</ul>\n"],
4132 any_li(opts,e) then 4135 any_li(opts,e) then
4133 - ["<li", format_attrs(opts), ">",format_element(e),"</li>\n"], 4136 + ["<li", format_attrs(opts), ">",format_element(e),"</li>\n"],
  4137 + any_button(options, e) then
  4138 + [["<button" + format_attrs(options) + ">"], format_element(e),"</button>\n"],
4134 }. 4139 }.
4135 4140
4136 4141
@@ -4257,7 +4262,9 @@ define Printable_tree @@ -4257,7 +4262,9 @@ define Printable_tree
4257 ul(opts, t) then 4262 ul(opts, t) then
4258 format(cinfo,sn,ic_v,any_ul(opts,t),format_element,is_https, action_count, head_tags), 4263 format(cinfo,sn,ic_v,any_ul(opts,t),format_element,is_https, action_count, head_tags),
4259 li(opts, t) then 4264 li(opts, t) then
4260 - format(cinfo,sn,ic_v,any_li(opts,t),format_element,is_https, action_count, head_tags), 4265 + format(cinfo,sn,ic_v,any_li(opts,t),format_element,is_https, action_count, head_tags),
  4266 + button(options, e) then
  4267 + format(cinfo,sn,ic_v,any_button(options, e),format_element,is_https, action_count, head_tags),
4261 }. 4268 }.
4262 4269
4263 4270
@@ -4344,7 +4351,8 @@ define Bool @@ -4344,7 +4351,8 @@ define Bool
4344 progress(_,_,_) then false, 4351 progress(_,_,_) then false,
4345 ol(_,_) then false, 4352 ol(_,_) then false,
4346 ul(_,_) then false, 4353 ul(_,_) then false,
4347 - li(_,_) then false 4354 + li(_,_) then false,
  4355 + button(_,_) then false
4348 }. 4356 }.
4349 4357
4350 define String 4358 define String
@@ -4483,7 +4491,8 @@ define Printable_tree @@ -4483,7 +4491,8 @@ define Printable_tree
4483 format(cinfo,sn,ic_v,any_ul(opts,t),format_element,is_https, action_count, head_tags), 4491 format(cinfo,sn,ic_v,any_ul(opts,t),format_element,is_https, action_count, head_tags),
4484 li(opts, t) then 4492 li(opts, t) then
4485 format(cinfo,sn,ic_v,any_li(opts,t),format_element,is_https, action_count, head_tags), 4493 format(cinfo,sn,ic_v,any_li(opts,t),format_element,is_https, action_count, head_tags),
4486 - 4494 + button(options, e) then
  4495 + format(cinfo, sn, ic_v, any_button(options, e), format_element, is_https, action_count, head_tags),
4487 }. 4496 }.
4488 4497
4489 4498
web/jQuery/CXM_jquery_button.anubis
@@ -226,11 +226,11 @@ public type JQuery_img_button: @@ -226,11 +226,11 @@ public type JQuery_img_button:
226 public define HTML_Off_Form 226 public define HTML_Off_Form
227 jquery_button_html 227 jquery_button_html
228 ( 228 (
229 - JQuery_img_button button, 229 + JQuery_img_button jq_img_button,
230 String button_id 230 String button_id
231 ) = 231 ) =
232 - if button is jquery_img_button(img_url, label_text, _, actioner, orientation) then  
233 - div([id(button_id), class("jq_img_btn")], 232 + since jq_img_button is jquery_img_button(img_url, label_text, _, actioner, orientation),
  233 + button([id(button_id), class("jq_img_btn")],
234 if orientation is 234 if orientation is
235 { 235 {
236 top then table([class("jq_img_btn_table")],[ row( cell(image(img_url))), row( cell(text(label_text))) ]), 236 top then table([class("jq_img_btn_table")],[ row( cell(image(img_url))), row( cell(text(label_text))) ]),