Sha256: 4c0e7fc78665d6e2a697b3cd31c176dad8aeb086d460627051bba529ac33dc91
Contents?: true
Size: 1.38 KB
Versions: 1
Compression:
Stored size: 1.38 KB
Contents
/* global $ */ "use strict"; /* Admin table */ function snapifyTable(snaptable) { var tableButtons = snaptable.find(".table_buttons"), editButton = tableButtons.find("a[class='edit']"), deleteButton = tableButtons.find("a[class='delete']"), showButton = tableButtons.find("a[class='show']"), path = window.location.pathname + "/"; // add ajax to the pagination snaptable.on("click", ".pagination a", function() { $.getScript(this.href); return false; }); // line clickable snaptable.on("click", "tbody tr", function(e) { var id = $(this).data("url") ; if ( typeof id !== "undefined" && !$(this).hasClass("selected") ) { snaptable.find("tr.selected").removeClass("selected"); $(this).addClass("selected"); deleteButton.add(editButton).add(showButton).addClass("on"); editButton.attr("href", path + id + "/edit"); deleteButton.attr("href", path + id); showButton.attr("href", path + id); } }); // Double click if(editButton.length) { snaptable.on("dblclick", "tbody tr", function() { var id = $(this).data("url"); if ( typeof id !== "undefined" ) { window.location = path + id + "/edit"; } }); } } function snapifyTables() { $(".snaptable").each(function() { snapifyTable($(this)); }) } $(document).on("ready page:load", function() { snapifyTables(); });
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
snaptable-1.2.0 | app/assets/javascripts/snaptable/table.js |