Made available call to external jQuery callbacks on add_fields click
This commit is contained in:
parent
630a88a704
commit
cebcb21242
|
@ -12,6 +12,7 @@ $(document).ready(function() {
|
|||
var content = $(this).attr('data-template');
|
||||
var insertionPosition = $(this).attr('data-association-insertion-position');
|
||||
var insertionNode = $(this).attr('data-association-insertion-node');
|
||||
var insertionCallback = $(this).data('insertion-callback');
|
||||
var regexp_braced = new RegExp('\\[new_' + assoc + '\\]', 'g');
|
||||
var regexp_underscord = new RegExp('_new_' + assoc + '_', 'g');
|
||||
var new_id = new Date().getTime();
|
||||
|
@ -31,11 +32,17 @@ $(document).ready(function() {
|
|||
else {
|
||||
insertionNode = $(this).parent();
|
||||
}
|
||||
|
||||
var contentNode = $(new_content);
|
||||
|
||||
if (insertionPosition == 'after'){
|
||||
insertionNode.after(new_content);
|
||||
insertionNode.after(contentNode);
|
||||
} else {
|
||||
insertionNode.before(new_content);
|
||||
insertionNode.before(contentNode);
|
||||
}
|
||||
|
||||
if(insertionCallback){
|
||||
insertionCallback.call(contentNode);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue