remove console.logs, make orderling less specific, add turbolinks support

This commit is contained in:
John Bintz 2012-12-13 18:51:47 -05:00
parent 0484ccbab5
commit d9e94ab3ed

View File

@ -47,16 +47,12 @@
} }
}, },
_updateFields: function(element) { _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).find($(element).data('fieldSearch')).each(function(index, element) {
$(element).val(index); $(element).val(index);
}); });
}, },
setup: function() { setup: function() {
$('li[data-ordered_by]').each(function(index, element) { $('[data-ordered_by]').each(function(index, element) {
var field = $(element).data('ordered_by'); var field = $(element).data('ordered_by');
var fieldSelector = "[name*='[" + field + "]']" var fieldSelector = "[name*='[" + field + "]']"
var fieldGroupSelector = "> .forms > .nested-fields" var fieldGroupSelector = "> .forms > .nested-fields"
@ -84,5 +80,6 @@
}; };
$(function() { $.cocoon.ordered.setup(); }); $(function() { $.cocoon.ordered.setup(); });
$(document).on('page:change', function() { $.cocoon.ordered.setup(); });
})(jQuery); })(jQuery);