Search in sources :

Example 1 with JavaScriptInlineFunction

use of de.agilecoders.wicket.jquery.function.JavaScriptInlineFunction in project syncope by apache.

the class IndicatingOnConfirmAjaxLink method renderHead.

@Override
public void renderHead(final IHeaderResponse response) {
    super.renderHead(response);
    if (enabled) {
        response.render(JavaScriptHeaderItem.forScript("proceed = false;", null));
        response.render($(this).on("click", new JavaScriptInlineFunction("" + "var element = $(this);" + "evt.preventDefault();" + "if (proceed == false) {" + "  evt.stopImmediatePropagation();" + "  bootbox.confirm('" + new ResourceModel(msg).getObject() + "', function(result) {" + "    if (result == true) {" + "      proceed = true;" + "      element.click();" + "    } else {" + "      proceed = false;" + "    }" + "  return true;" + "  })" + "} else {" + "  proceed = false;" + "};", new ArrayList<>())).asDomReadyScript());
    }
}
Also used : JavaScriptInlineFunction(de.agilecoders.wicket.jquery.function.JavaScriptInlineFunction) ArrayList(java.util.ArrayList) ResourceModel(org.apache.wicket.model.ResourceModel)

Aggregations

JavaScriptInlineFunction (de.agilecoders.wicket.jquery.function.JavaScriptInlineFunction)1 ArrayList (java.util.ArrayList)1 ResourceModel (org.apache.wicket.model.ResourceModel)1