Hey folks, I recently stumbled upon an issue, which caused my destroy links to malfunction. It’s bundled to using AbsoluteAdmin (http://admindesigns.com/demos/absolute/1.1/index.html). I’ve separated everything in my project into two folders – admin and front (for admin part I’m using AbsoluteAdmin and for the front part another theme). This is my loading order for admin.js (assets/javascripts/admin) :
//= require_tree ../../../vendor/assets/javascripts/admin/plugins/moment/. //= require jquery //= require jquery_ujs //= require_tree ../../../vendor/assets/javascripts/admin/jquery_ui/. //= require_tree ../../../vendor/assets/javascripts/admin/plugins/. //= require_tree ../../../vendor/assets/javascripts/admin/daterange/. //= require_tree ../../../vendor/assets/javascripts/admin/utility/. //= require_tree ../../../vendor/assets/javascripts/admin/demo/. //= require admin/main //= require_self //= require_tree ../../../app/assets/javascripts/admin/. //= require turbolinks
I’ve spent a lot of time figuring out how to make all of those JS from AbsoluteAdmin work, thus, I think, this exact order is important. However, admin/main (which is located at vendor/javascripts/admin/main.js) apparently breaks UJS. After a bit of detective work there was only one candidate for this behavior – the function ‚runHeader();‘
return { init: function(options) { // Set Default Options var defaults = { sbl: "sb-l-o", // sidebar left open onload sbr: "sb-r-c", // sidebar right closed onload sbState: "save", //Enable localstorage for sidebar states collapse: "sb-l-m", // sidebar left collapse style siblingRope: true // Setting this true will reopen the left sidebar // when the right sidebar is closed }; // Extend Default Options. var options = $.extend({}, defaults, options); // Call Core Functions runHelpers(); runAnimations(); // As of 28/08/2016 runHeader causes jquery_ujs to break // runHeader(); runSideMenu(options); runFooter(); runTrays(); runFormElements(); } } }();
As you can see, I commented it already out (line 22 in the snippet and line 720 in the actual file) and now everything works as expected!