$.fn.findExtended = (selector) -> if _.str.startsWith(selector, "parent=") @.parents(selector.substring("parent=".length)) else if _.str.startsWith(selector, "field=") @.parents(".form-inputs:first").find("*[name$='[" + selector.substring("field=".length) + "]']") else $(selector) $(document).on 'nested:fieldAdded', 'form', (content) -> form = new Basepack.Form(content.field) form.bind() $(document).on 'click.data-api', '[data-toggle="checkboxes"]', -> $($(@).data('target')).prop "checked", $(@).is(":checked") $(document).on 'click.data-api', '[data-toggleclass]', (e) -> $(@).toggleClass($(@).data("toggleclass")) $(document).on 'click.data-api', '[data-toggle="ajax-modal"]', (e) -> # ajax modals $("body").modalmanager "loading" # create the backdrop and wait for next modal to be triggered $modal = $("