"Add new attachment" button works.

This commit is contained in:
2016-11-02 12:11:46 +01:00
parent 90c6fdc377
commit 6ea7386bd3
2 changed files with 21 additions and 8 deletions

View File

@@ -39,4 +39,24 @@
}, scroll_duration_msec);
}
/**
* Marks the queried buttons as "Add New Attachment" buttons.
*/
$.fn.addNewAttachmentButton = function() {
var $button = this;
$button.click(function() {
console.log('Cloning last repeating group');
var lastRepeatingGroup = $button
.parent()
.next('.attachments')
.children('ul.fieldlist')
.children('li')
.last();
console.log(lastRepeatingGroup.toArray());
var cloned = lastRepeatingGroup.clone(false);
cloned.insertAfter(lastRepeatingGroup);
resetAttributeNames(cloned);
cloned.find('.fileupload').each(setup_file_uploader)
})
}
}(jQuery));