Commit 50386923b6f400b0b099f4abeda356fa69805cdc
1 parent
5b6fb409
add call back in img_button_confirm which be called after the web_action. For ex…
…ample after a web_action executed, refresh the page (which made by the call back)
Showing
1 changed file
with
8 additions
and
4 deletions
Show diff stats
web/widgets/button.anubis
| ... | ... | @@ -249,12 +249,15 @@ define List(CoreAttrs) |
| 249 | 249 | String uid, |
| 250 | 250 | WEB_Action_Name web_action, |
| 251 | 251 | List((String, String)) extra_ops, |
| 252 | - String load_content_target | |
| 252 | + String load_content_target, | |
| 253 | + String call_back | |
| 253 | 254 | ) = |
| 254 | 255 | //action to execute if confirmation is ok |
| 255 | 256 | |
| 256 | 257 | with ok_action = if load_content_target = "" then |
| 257 | - to_JS_String("Xlib.jq_query("+format_web_action_name_to_js(web_action, extra_ops)+")") | |
| 258 | + with call_back_js = if call_back = "" then "" else | |
| 259 | + ", undefined, "+to_JS_String(call_back), | |
| 260 | + to_JS_String("Xlib.jq_query("+format_web_action_name_to_js(web_action, extra_ops) + call_back_js+")") | |
| 258 | 261 | else |
| 259 | 262 | load_content_JS_String(load_content_target, web_action, extra_ops, true, true), |
| 260 | 263 | //to_JS_String("Xlib.load_content('"++"', "+format_web_action_name_to_js(web_action, extra_ops)+", true)"), |
| ... | ... | @@ -345,12 +348,13 @@ public define HTML_Partial_Content |
| 345 | 348 | WEB_Action_Name web_action, |
| 346 | 349 | List((String, String)) extra_ops, |
| 347 | 350 | String load_content_target //if empty doesn't use load content |
| 351 | + String call_back //callback to execute after the web action | |
| 348 | 352 | ) = |
| 349 | 353 | with uid = generate_random_string(20), |
| 350 | 354 | //with event_click = (CoreAttrs)event(onclick, "Xlib.jq_query("+format_web_action_name_to_js(web_action, extra_ops)+")"), |
| 351 | 355 | |
| 352 | 356 | partial_content([js(js_file("xlib/js/xlib.js")), js_inline(jquery_ready(img_button_confirm_js(uid, dlg_title, dlg_text, dlg_ok, dlg_cancel)))], |
| 353 | - img(img_button_confirm_image_attrs(core_attrs, uid, web_action, extra_ops, load_content_target), img_path)) | |
| 357 | + img(img_button_confirm_image_attrs(core_attrs, uid, web_action, extra_ops, load_content_target, call_back), img_path)) | |
| 354 | 358 | . |
| 355 | 359 | |
| 356 | 360 | public define HTML_Partial_Content |
| ... | ... | @@ -365,5 +369,5 @@ public define HTML_Partial_Content |
| 365 | 369 | WEB_Action_Name web_action, |
| 366 | 370 | List((String, String)) extra_ops |
| 367 | 371 | ) = |
| 368 | - img_button_confirm(img_path, core_attrs, dlg_title, dlg_text, dlg_ok, dlg_cancel, web_action, extra_ops, "") | |
| 372 | + img_button_confirm(img_path, core_attrs, dlg_title, dlg_text, dlg_ok, dlg_cancel, web_action, extra_ops, "", "") | |
| 369 | 373 | . | ... | ... |