fix some slow javascript. oops

This commit is contained in:
John Bintz 2013-04-10 18:34:47 -04:00
parent 996ccd55f0
commit 7b8cd65a55
2 changed files with 6 additions and 5 deletions

View File

@ -11,7 +11,7 @@
return $(this).parent().siblings(selector);
}
$('.add_fields').live('click', function(e) {
$(document).on('click', '.add_fields', function(e) {
e.preventDefault();
var $this = $(this),
assoc = $this.data('association'),
@ -67,7 +67,6 @@
trigger_node.trigger('cocoon:before-remove', [node_to_delete]);
var timeout = trigger_node.data('remove-timeout') || 0;
setTimeout(

View File

@ -1,8 +1,7 @@
//= require jquery.ui.all
//
(function($) {
$.cocoon = {
ordered: {
isSetUp: false,
options: {
items: '> .nested-fields',
stop: function(e, ui) {
@ -74,7 +73,10 @@
});
});
if (!$.cocoon.ordered.isSetUp) {
$(document).on('cocoon:after-insert', function() { $.cocoon.ordered.setup(); });
$.cocoon.ordered.isSetUp = true;
}
}
},
};