From 0eadd7a3f4cb51f19b207db9ea292dc041767291 Mon Sep 17 00:00:00 2001 From: totoro Date: Thu, 20 Aug 2020 14:58:17 +0900 Subject: [PATCH] add img_button_load_dialog and jq_dialog_load. This allows to open jquery dialog by loading the HTML content with an ajax call --- web/jQuery/CXM_jquery_dialog.anubis | 25 ++++++++++++++++++++++++- web/widgets/button.anubis | 9 +++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/web/jQuery/CXM_jquery_dialog.anubis b/web/jQuery/CXM_jquery_dialog.anubis index 55442af..558b68a 100644 --- a/web/jQuery/CXM_jquery_dialog.anubis +++ b/web/jQuery/CXM_jquery_dialog.anubis @@ -14,6 +14,7 @@ public type JQuery_dialog_id: dialog_id(String id). public type JQuery_dialog: + empty, p_content(HTML_Partial_Content content), off_form(HTML_Off_Form o_form), ajax(WEB_Action_Name url). @@ -64,6 +65,8 @@ $( \"#"+dlg_id+"\" ).dialog({ if content is { + empty then + partial_content([js], div([id(dlg_id)], empty)), p_content(pc) then if pc is partial_content(tags, html) then partial_content( [js . tags ], div([id(dlg_id)], html)), //html code of the dialog @@ -119,7 +122,27 @@ public define HTML_Partial_Content Bool autoOpen )= jq_dialog_create(dial_id, content, autoOpen, auto, ""). - + +public define String + jq_dialog_load + ( + JQuery_dialog_id dialog_id, + WEB_Action_Name action, + List((String,String)) extra_ops + )= + "CalexiumToolBox.jq_dialog_load('"+id(dialog_id)+"',"+format_web_action_name_to_js(action, extra_ops)+");" +. + + +public define String + jq_dialog_load + ( + JQuery_dialog_id dialog_id, + WEB_Action_Name action + )= + jq_dialog_load(dialog_id, action) +. + define String _jq_dialog_open ( diff --git a/web/widgets/button.anubis b/web/widgets/button.anubis index fcd90d7..47df2b6 100644 --- a/web/widgets/button.anubis +++ b/web/widgets/button.anubis @@ -161,6 +161,15 @@ public define HTML_Partial_Content )= img_button(img_path, core_attrs, same, url, extra_ops). +public define HTML_Partial_Content + img_button_load_dialog + ( + String img_path, + List(CoreAttrs) core_attrs + )= + img_button(img_path, core_attrs, same, "", []) +. + define inline String img_button_confirm_js ( -- libgit2 0.21.4