Commit 13f21b8907a9830f3092e0e7591a6b49c2b94ed9
1 parent
03a43f2d
add img button with confirmation with WEB_Action_Name and extra ops
Showing
1 changed file
with
33 additions
and
0 deletions
Show diff stats
web/widgets/button.anubis
| ... | ... | @@ -147,6 +147,19 @@ define List(CoreAttrs) |
| 147 | 147 | ) = |
| 148 | 148 | 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)) +");")]. |
| 149 | 149 | |
| 150 | +define List(CoreAttrs) | |
| 151 | + img_button_confirm_image_attrs | |
| 152 | + ( | |
| 153 | + List(CoreAttrs) core_attrs, | |
| 154 | + String uid, | |
| 155 | + WEB_Action_Name web_action, | |
| 156 | + List((String, String)) extra_ops | |
| 157 | + ) = | |
| 158 | + //action to execute if confirmation is ok | |
| 159 | + with ok_action = to_JS_String("CalexiumToolBox.jq_query("+format_web_action_name_to_js(web_action, extra_ops)+")"), | |
| 160 | + | |
| 161 | + core_attrs + [id(uid), style("cursor: pointer"), event(onclick, "CalexiumToolBox.make_confirm_dialog(this, "+ ok_action +");")]. | |
| 162 | + | |
| 150 | 163 | public define HTML_Partial_Content |
| 151 | 164 | img_button_confirm |
| 152 | 165 | ( |
| ... | ... | @@ -217,3 +230,23 @@ public define String |
| 217 | 230 | JQuery_Actioner actioner |
| 218 | 231 | )= |
| 219 | 232 | img_button_confirm(img_path, [], dlg_title, dlg_text, dlg_ok, dlg_cancel, actioner). |
| 233 | + | |
| 234 | + | |
| 235 | +public define String | |
| 236 | + img_button_confirm | |
| 237 | + ( | |
| 238 | + String img_path, | |
| 239 | + List(CoreAttrs) core_attrs, | |
| 240 | + String dlg_title, | |
| 241 | + String dlg_text, | |
| 242 | + String dlg_ok, | |
| 243 | + String dlg_cancel, | |
| 244 | + WEB_Action_Name web_action, | |
| 245 | + List((String, String)) extra_ops | |
| 246 | + ) = | |
| 247 | + with uid = generate_random_string(20), | |
| 248 | + //with event_click = (CoreAttrs)event(onclick, "CalexiumToolBox.jq_query("+format_web_action_name_to_js(web_action, extra_ops)+")"), | |
| 249 | + | |
| 250 | + "<script type=\"text/javascript\">" + jquery_ready(img_button_confirm_js(uid, dlg_title, dlg_text, dlg_ok, dlg_cancel)) + "</script>" + | |
| 251 | + "<img " + format_attrs(img_button_confirm_image_attrs(core_attrs, uid, web_action, extra_ops)) + " src=\"" + img_path + "\"></img>" | |
| 252 | +. | ... | ... |