From d9e94ab3ed078989e4ff154b5f892c7ee697361b Mon Sep 17 00:00:00 2001 From: John Bintz Date: Thu, 13 Dec 2012 18:51:47 -0500 Subject: [PATCH] remove console.logs, make orderling less specific, add turbolinks support --- app/assets/javascripts/cocoon/ordered.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/cocoon/ordered.js b/app/assets/javascripts/cocoon/ordered.js index 99a9ffc..f90bc75 100644 --- a/app/assets/javascripts/cocoon/ordered.js +++ b/app/assets/javascripts/cocoon/ordered.js @@ -47,16 +47,12 @@ } }, _updateFields: function(element) { - console.log(element) - console.log($(element).data('fieldSearch')) - console.log($(element).find($(element).data('fieldSearch'))) - $(element).find($(element).data('fieldSearch')).each(function(index, element) { $(element).val(index); }); }, setup: function() { - $('li[data-ordered_by]').each(function(index, element) { + $('[data-ordered_by]').each(function(index, element) { var field = $(element).data('ordered_by'); var fieldSelector = "[name*='[" + field + "]']" var fieldGroupSelector = "> .forms > .nested-fields" @@ -84,5 +80,6 @@ }; $(function() { $.cocoon.ordered.setup(); }); + $(document).on('page:change', function() { $.cocoon.ordered.setup(); }); })(jQuery);