app/assets/javascripts/adminpanel/images_form.js in adminpanel-1.2.12 vs app/assets/javascripts/adminpanel/images_form.js in adminpanel-2.0.0

- old
+ new

@@ -1,6 +1,6 @@ -$(document).ready(function(){ +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; @@ -15,6 +15,9 @@ $('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);