Sha256: 728d1b85de9fa51a78acddea52400ed8b1056dcaca5f712f48e03b58552568d6
Contents?: true
Size: 527 Bytes
Versions: 43
Compression:
Stored size: 527 Bytes
Contents
# When we add a cocoon element, it copies a static template into the DOM # We have to update this template to have a unique ID $(document).on 'cocoon:before-insert', (event, item) -> return true if item.find('.asset-box-uploader').length == 0 html = item.html() item.find('.asset-box-uploader').each (index, element) => from = $(element).attr('id').replace('s3_', '') to = from.replace(/\d.?\d/g, '') + (new Date().getTime()) + '-' + index html = html.replace(new RegExp(from, 'g'), to) item.html(html)
Version data entries
43 entries across 43 versions & 1 rubygems