From aba83952bb1e3c0d58692aa460c06656ecfd3c9e Mon Sep 17 00:00:00 2001 From: totoro Date: Tue, 25 Nov 2014 10:16:19 +0100 Subject: [PATCH] add button_type type and move css to css/cxm/ --- web/jQuery/CXM_jquery_button.anubis | 54 +++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 41 insertions(+), 13 deletions(-) diff --git a/web/jQuery/CXM_jquery_button.anubis b/web/jQuery/CXM_jquery_button.anubis index 3c9a2f5..ccbc01e 100644 --- a/web/jQuery/CXM_jquery_button.anubis +++ b/web/jQuery/CXM_jquery_button.anubis @@ -15,12 +15,40 @@ read system/string.anubis read tools/random.anubis +public type JQuery_button_type: + button, + reset, + submit. + +public define String + to_String + ( + JQuery_button_type bt_type + )= + if bt_type is + { + button then "button", + reset then "reset", + submit then "submit" + }. + public type JQuery_button: - jQuery_button( + jQuery_button( JQuery_button_type bt_type, String button_id, String button_name, String button_label, JQuery_Actioner actioner, JQuery_icon primary, JQuery_icon secondary // primary icon is for left icon, secondary icon is for right icon and button_id must set with an unique ID in order to have icons working ) . +public define JQuery_button + jQuery_button + ( + JQuery_button_type bt_type, + String button_id, + String button_name, + String button_label, + JQuery_Actioner actioner + ) = + jQuery_button(bt_type, button_id, button_name, button_label, actioner, jq_icon_none, jq_icon_none). + define String jquery_button_get_onclick_action_window_options ( @@ -132,14 +160,15 @@ define HTML_Partial_Content sequence(reverse(html_buttons)) ), [ h . t ] then - if h is jQuery_button(id, name, label, actioner, primary, secondary) then + if h is jQuery_button(bt_type, id, name, label, actioner, primary, secondary) then with onclick_action=jquery_button_get_onclick_action(id, actioner), if id = "" then // if the ID is not set => we can't use icons in the buttonset. _jquery_buttons( t, [ onclick_action . html_tags ], [ - literal("") + literal("") + . html_buttons ] @@ -155,7 +184,7 @@ define HTML_Partial_Content ] +html_tags, [ - literal("") + literal("") . html_buttons ] @@ -213,12 +242,11 @@ public define HTML_Partial_Content List(JQuery_button) buttons ) = - if _jquery_buttons(buttons, [], []) is partial_content(tags, html) then partial_content( - [ js_inline(jquery_ready("$('#"+buttons_container_id+"').buttonset();")) ] + tags, + [ js_inline(jquery_ready("$('#"+buttons_container_id+"').buttonset();")) ], sequence([ literal("
"), - html, + partial(_jquery_buttons(buttons, [], [])), literal("
") ]) ) @@ -230,7 +258,7 @@ public define HTML_Partial_Content JQuery_button button ) = - if button is jQuery_button(id, name, label, actioner, primary, secondary) then + if button is jQuery_button(bt_type, id, name, label, actioner, primary, secondary) then with onclick_action=jquery_button_get_onclick_action(id, actioner), if jquery_icon_to_string(primary) = "" then if jquery_icon_to_string(secondary) = "" then @@ -239,7 +267,7 @@ public define HTML_Partial_Content js_inline(jquery_ready("$('#"+id+"').button();")), onclick_action ], - literal("") + literal("") ) else partial_content( @@ -247,7 +275,7 @@ public define HTML_Partial_Content js_inline(jquery_ready("$('#"+id+"').button({icons:{secondary:'"+jquery_icon_to_string(secondary)+"'}});")), onclick_action ], - literal("") + literal("") ) else if jquery_icon_to_string(secondary) = "" then @@ -256,7 +284,7 @@ public define HTML_Partial_Content js_inline(jquery_ready("$('#"+id+"').button({icons:{primary:'"+jquery_icon_to_string(primary)+"'}});")), onclick_action ], - literal("") + literal("") ) else partial_content( @@ -264,7 +292,7 @@ public define HTML_Partial_Content js_inline(jquery_ready("$('#"+id+"').button({icons:{primary:'"+jquery_icon_to_string(primary)+"',secondary:'"+jquery_icon_to_string(secondary)+"'}});")), onclick_action ], - literal("") + literal("") ) . @@ -308,7 +336,7 @@ public define HTML_Partial_Content partial_content( [ jquery_button_get_onclick_action(button_id_str, actioner), - css(css_file("css/cxm_button.css")), + css(css_file("css/cxm/cxm_button.css")), js_inline(jquery_ready("$('.jq_img_btn').button();")) ], jquery_button_html(button, button_id_str)) -- libgit2 0.21.4