Sha256: 54ea221f63f976b1c50899282f9cdd4b0ba6de7d283fcd31724f379f3bf99bc1
Contents?: true
Size: 777 Bytes
Versions: 15
Compression:
Stored size: 777 Bytes
Contents
var ready = function(){ $('form').on('click', '.add_fields', function(e) { e.preventDefault(); var $collectionContainer = $(this).closest('.file-collection-container'); var maxFiles = $collectionContainer.data('max'); var numberOfFiles = $collectionContainer.find('.product-image:not(.hidden)').length + 1; if (maxFiles == '0' || numberOfFiles <= maxFiles) { time = new Date().getTime(); regexp = new RegExp($(this).data('id'), 'g'); $(this).before($(this).data('fields').replace(regexp, time)); } }); $('form').on('click', '.remove_fields', function(e){ $(this).prev('input[type=hidden]').val('1'); $(this).parent().parent().parent().addClass('hidden'); e.preventDefault(); }); } $(document).ready(ready); $(document).on('page:load', ready);
Version data entries
15 entries across 15 versions & 1 rubygems