From 13f21b8907a9830f3092e0e7591a6b49c2b94ed9 Mon Sep 17 00:00:00 2001 From: totoro Date: Sun, 11 Nov 2018 21:00:26 +0900 Subject: [PATCH] add img button with confirmation with WEB_Action_Name and extra ops --- web/widgets/button.anubis | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+), 0 deletions(-) diff --git a/web/widgets/button.anubis b/web/widgets/button.anubis index c37f1f1..e642d5f 100644 --- a/web/widgets/button.anubis +++ b/web/widgets/button.anubis @@ -147,6 +147,19 @@ define List(CoreAttrs) ) = core_attrs + [id(uid), style("cursor: pointer"), event(onclick, "CalexiumToolBox.make_confirm_dialog(this, "/* + to_js_string("/?a=" + url + format_extra_operands(extra_ops))+*/+ to_JS_String(jquery_button_get_onclick_action(actioner)) +");")]. +define List(CoreAttrs) + img_button_confirm_image_attrs + ( + List(CoreAttrs) core_attrs, + String uid, + WEB_Action_Name web_action, + List((String, String)) extra_ops + ) = + //action to execute if confirmation is ok + with ok_action = to_JS_String("CalexiumToolBox.jq_query("+format_web_action_name_to_js(web_action, extra_ops)+")"), + + core_attrs + [id(uid), style("cursor: pointer"), event(onclick, "CalexiumToolBox.make_confirm_dialog(this, "+ ok_action +");")]. + public define HTML_Partial_Content img_button_confirm ( @@ -217,3 +230,23 @@ public define String JQuery_Actioner actioner )= img_button_confirm(img_path, [], dlg_title, dlg_text, dlg_ok, dlg_cancel, actioner). + + +public define String + img_button_confirm + ( + String img_path, + List(CoreAttrs) core_attrs, + String dlg_title, + String dlg_text, + String dlg_ok, + String dlg_cancel, + WEB_Action_Name web_action, + List((String, String)) extra_ops + ) = + with uid = generate_random_string(20), + //with event_click = (CoreAttrs)event(onclick, "CalexiumToolBox.jq_query("+format_web_action_name_to_js(web_action, extra_ops)+")"), + + "" + + "" +. -- libgit2 0.21.4