From a55ca6d75b244084b73cdb26c763e064839853cf Mon Sep 17 00:00:00 2001 From: Julien Verneuil Date: Thu, 31 Mar 2016 15:59:41 +0200 Subject: [PATCH] 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 | 23 ++++++++++++++++------- web/jQuery/CXM_jquery_button.anubis | 6 +++--- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/web/CXM_making_a_web_site.anubis b/web/CXM_making_a_web_site.anubis index 378c5c5..b107db7 100644 --- a/web/CXM_making_a_web_site.anubis +++ b/web/CXM_making_a_web_site.anubis @@ -1191,7 +1191,8 @@ public type HTML_In_Form: progress (List(CoreAttrs), Int value, Int max), ol (List(CoreAttrs), HTML_In_Form content), ul (List(CoreAttrs), HTML_In_Form content), - li (List(CoreAttrs), HTML_In_Form content). + li (List(CoreAttrs), HTML_In_Form content), + button (List(CoreAttrs), HTML_In_Form content). '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: progress (List(CoreAttrs), Int value, Int max), ol (List(CoreAttrs), HTML_Off_Form content), ul (List(CoreAttrs), HTML_Off_Form content), - li (List(CoreAttrs), HTML_Off_Form content). + li (List(CoreAttrs), HTML_Off_Form content), + button (List(CoreAttrs), HTML_Off_Form content). 'HTML_Off_Form' defines all the elements you may put outside any form. @@ -2818,7 +2820,8 @@ type HTML_Any($T): any_coreattrs (List(CoreAttrs)), any_ol (List(CoreAttrs), $T content), any_ul (List(CoreAttrs), $T content), - any_li (List(CoreAttrs), $T content). + any_li (List(CoreAttrs), $T content), + any_button (List(CoreAttrs), $T element). @@ -4130,7 +4133,9 @@ define Printable_tree any_ul(opts,e) then ["",format_element(e),"\n"], any_li(opts,e) then - ["",format_element(e),"\n"], + ["",format_element(e),"\n"], + any_button(options, e) then + [[""], format_element(e),"\n"], }. @@ -4257,7 +4262,9 @@ define Printable_tree ul(opts, t) then format(cinfo,sn,ic_v,any_ul(opts,t),format_element,is_https, action_count, head_tags), li(opts, t) then - format(cinfo,sn,ic_v,any_li(opts,t),format_element,is_https, action_count, head_tags), + format(cinfo,sn,ic_v,any_li(opts,t),format_element,is_https, action_count, head_tags), + button(options, e) then + format(cinfo,sn,ic_v,any_button(options, e),format_element,is_https, action_count, head_tags), }. @@ -4344,7 +4351,8 @@ define Bool progress(_,_,_) then false, ol(_,_) then false, ul(_,_) then false, - li(_,_) then false + li(_,_) then false, + button(_,_) then false }. define String @@ -4483,7 +4491,8 @@ define Printable_tree format(cinfo,sn,ic_v,any_ul(opts,t),format_element,is_https, action_count, head_tags), li(opts, t) then format(cinfo,sn,ic_v,any_li(opts,t),format_element,is_https, action_count, head_tags), - + button(options, e) then + format(cinfo, sn, ic_v, any_button(options, e), format_element, is_https, action_count, head_tags), }. diff --git a/web/jQuery/CXM_jquery_button.anubis b/web/jQuery/CXM_jquery_button.anubis index 7f4c4ac..6685f0b 100644 --- a/web/jQuery/CXM_jquery_button.anubis +++ b/web/jQuery/CXM_jquery_button.anubis @@ -226,11 +226,11 @@ public type JQuery_img_button: public define HTML_Off_Form jquery_button_html ( - JQuery_img_button button, + JQuery_img_button jq_img_button, String button_id ) = - if button is jquery_img_button(img_url, label_text, _, actioner, orientation) then - div([id(button_id), class("jq_img_btn")], + since jq_img_button is jquery_img_button(img_url, label_text, _, actioner, orientation), + button([id(button_id), class("jq_img_btn")], if orientation is { top then table([class("jq_img_btn_table")],[ row( cell(image(img_url))), row( cell(text(label_text))) ]), -- libgit2 0.21.4