{:uriI"file:///Users/forsaken/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/activeadmin-1.3.1/app/assets/javascripts/active_admin/lib/has_many.js.coffee?type=application/javascript&pipeline=self&id=478521c63c790b0887e3e9d91235d5f93611e7c9e59fa172165a3efae2305348:ET:load_pathI"l/Users/forsaken/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/activeadmin-1.3.1/app/assets/javascripts;T: filenameI"‹/Users/forsaken/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/activeadmin-1.3.1/app/assets/javascripts/active_admin/lib/has_many.js.coffee;T: nameI"active_admin/lib/has_many;T:logical_pathI"&active_admin/lib/has_many.self.js;T:content_typeI"application/javascript;T: sourceI"ï (function() { var init_sortable, recompute_positions; $(function() { $(document).on('click', 'a.button.has_many_remove', function(e) { var parent, to_remove; e.preventDefault(); parent = $(this).closest('.has_many_container'); to_remove = $(this).closest('fieldset'); recompute_positions(parent); parent.trigger('has_many_remove:before', [to_remove, parent]); to_remove.remove(); return parent.trigger('has_many_remove:after', [to_remove, parent]); }); $(document).on('click', 'a.button.has_many_add', function(e) { var before_add, fieldset, html, index, parent, regex; e.preventDefault(); parent = $(this).closest('.has_many_container'); parent.trigger(before_add = $.Event('has_many_add:before'), [parent]); if (!before_add.isDefaultPrevented()) { index = parent.data('has_many_index') || parent.children('fieldset').length - 1; parent.data({ has_many_index: ++index }); regex = new RegExp($(this).data('placeholder'), 'g'); html = $(this).data('html').replace(regex, index); fieldset = $(html).insertBefore(this); recompute_positions(parent); return parent.trigger('has_many_add:after', [fieldset, parent]); } }); $(document).on('change', '.has_many_container[data-sortable] :input[name$="[_destroy]"]', function() { return recompute_positions($(this).closest('.has_many')); }); init_sortable(); return $(document).on('has_many_add:after', '.has_many_container', init_sortable); }); init_sortable = function() { var elems; elems = $('.has_many_container[data-sortable]:not(.ui-sortable)'); elems.sortable({ items: '> fieldset', handle: '> ol > .handle', stop: recompute_positions }); return elems.each(recompute_positions); }; recompute_positions = function(parent) { var input_name, position; parent = parent instanceof jQuery ? parent : $(this); input_name = parent.data('sortable'); position = parseInt(parent.data('sortable-start') || 0, 10); return parent.children('fieldset').each(function() { var destroy_input, sortable_input; destroy_input = $(this).find("> ol > .input > :input[name$='[_destroy]']"); sortable_input = $(this).find("> ol > .input > :input[name$='[" + input_name + "]']"); if (sortable_input.length) { return sortable_input.val(destroy_input.is(':checked') ? '' : position++); } }); }; }).call(this); ;T: metadata{ :dependencieso:Set: @hash} I"environment-version;TTI"environment-paths;TTI"rails-env;TTI"jprocessors:type=application/javascript&file_type=application/javascript&engines=.coffee&pipeline=self;TTI"™file-digest:///Users/forsaken/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/activeadmin-1.3.1/app/assets/javascripts/active_admin/lib/has_many.js.coffee;TTF: requiredo;;}F: stubbedo;;}F: linkso;;}F: charsetI" utf-8;F: digest"%ìãÞ½À¥ jè¬lü ì«8%C´¹NYuÓÓ»: lengthiï :dependencies_digest"%çŸØ¬tFCüçùý#sªtÐJ $Æëšµñz¶ÁœÚ:idI"E478521c63c790b0887e3e9d91235d5f93611e7c9e59fa172165a3efae2305348;F: mtimel+’¿y[