From 6fd7717b2a584565dc8d8f67ab6233f69c56b63d Mon Sep 17 00:00:00 2001 From: totoro Date: Sat, 18 Apr 2015 19:44:29 +0200 Subject: [PATCH] [+] add jq_button_confirm which show you a dialog confirmation before submit the action --- web/CXM_jquery.anubis | 3 +-- web/jQuery/CXM_jquery_button.anubis | 51 +++++++++++++++++++++++++++++++++++++++++++++++++-- web/jQuery/CXM_jquery_datatable.anubis | 18 +++++++++++++++++- 3 files changed, 67 insertions(+), 5 deletions(-) diff --git a/web/CXM_jquery.anubis b/web/CXM_jquery.anubis index e525136..30df353 100644 --- a/web/CXM_jquery.anubis +++ b/web/CXM_jquery.anubis @@ -4,7 +4,6 @@ * Date: 21/08/2012 * Time: 16:52 * - * To change this template use Tools | Options | Coding | Edit Standard Headers. */ read calexium_lib/web/CXM_making_a_web_site.anubis @@ -19,7 +18,7 @@ public type JQuery_Actioner_type: /* jQuery Actioner */ public type JQuery_Actioner: - jQuery_actioner(Actioner_Target target, JQuery_Actioner_type type, String url_or_form_id). + jQuery_actioner(Actioner_Target target, JQuery_Actioner_type type, String url_or_form_id_or_script). /* */ diff --git a/web/jQuery/CXM_jquery_button.anubis b/web/jQuery/CXM_jquery_button.anubis index ccbc01e..a055e0f 100644 --- a/web/jQuery/CXM_jquery_button.anubis +++ b/web/jQuery/CXM_jquery_button.anubis @@ -18,7 +18,7 @@ read tools/random.anubis public type JQuery_button_type: button, reset, - submit. + submit. //button with confirmation dialog public define String to_String @@ -149,7 +149,7 @@ define HTML_Partial_Content ( List(JQuery_button) buttons, List(HTML_Head_Tag) html_tags, - List(HTML_Off_Form) html_buttons + List(HTML_Off_Form) html_buttons ) = if buttons is @@ -342,3 +342,50 @@ public define HTML_Partial_Content jquery_button_html(button, button_id_str)) . +public define HTML_Partial_Content + jq_button_confirm + ( + String button_label, + String dlg_title, + String dlg_text, + String dlg_ok, + String dlg_cancel, + String url, + List((String, String)) extra_ops + )= + with button_id = generate_random_string(10), + button_name = button_id, + actioner = jQuery_actioner(same, jqscript, " + + $( '#" + button_id + "_dlg' ).dialog({ + title: '" + dlg_title + "', + resizable: false, + modal: true, + buttons: { + '" + dlg_ok + "': function() { + document.location='/?a=" + url + format_extra_operands(extra_ops)+"'; + }, + '" + dlg_cancel + "': function() { + $( this ).dialog( 'close' ); + } + } + });"), + partial_content(sequence([ + div([id(button_id+"_dlg"),style("display: none;")], text(dlg_text)), + partial(jquery_button(jQuery_button(button, button_id, button_name, button_label, actioner, jq_icon_none, jq_icon_none))) + ])). + + + +public define HTML_Partial_Content + jq_button_confirm + ( + String button_label, + String dlg_title, + String dlg_text, + String dlg_ok, + String dlg_cancel, + String url + )= + jq_button_confirm(button_label, dlg_title, dlg_text, dlg_ok, dlg_cancel, url, []). + diff --git a/web/jQuery/CXM_jquery_datatable.anubis b/web/jQuery/CXM_jquery_datatable.anubis index 619a0b4..bc9f60b 100644 --- a/web/jQuery/CXM_jquery_datatable.anubis +++ b/web/jQuery/CXM_jquery_datatable.anubis @@ -70,7 +70,7 @@ public define HTML_Partial_Content jquery_datatable ( String table_id, - HTML_Off_Form table, + HTML_Partial_Content table, Bool enable_jqueryui, Bool enable_pagination, JQuery_datatable_pagination_type pagination_type, @@ -125,4 +125,20 @@ public define HTML_Partial_Content Bool enable_columns_sorting, String web_dir ) = + jquery_datatable(table_id, partial_content(table), enable_jqueryui, enable_pagination, pagination_type, scrollY, enable_change_page_length, enable_search_field, enable_columns_sorting, "en", no_extra, web_dir). + +public define HTML_Partial_Content + jquery_datatable + ( + String table_id, + HTML_Partial_Content table, + Bool enable_jqueryui, + Bool enable_pagination, + JQuery_datatable_pagination_type pagination_type, + JQuery_datatable_scrollY_type scrollY, + Bool enable_change_page_length, // if true, "enable_pagination" must be true too. + Bool enable_search_field, + Bool enable_columns_sorting, + String web_dir + ) = jquery_datatable(table_id, table, enable_jqueryui, enable_pagination, pagination_type, scrollY, enable_change_page_length, enable_search_field, enable_columns_sorting, "en", no_extra, web_dir). -- libgit2 0.21.4