test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 in kaui-0.1.11 vs test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 in kaui-0.1.12

- old
+ new

@@ -1,8 +1,8 @@ -o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1345650927.4971871: @value"±Ò{I" +o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1348012764.674015: @value"Xê{I" class:EFI"BundledAsset;FI"logical_path;FI"application.js;TI" pathname;FI"0$root/app/assets/javascripts/application.js;FI"content_type;FI"application/javascript;FI" -mtime;FI"2012-08-21T21:40:16-07:00;FI" length;FiÑI" digest;F"%ad657f583100b3d2c267f0960bb5f394I" source;FI"Ñ/*! +mtime;FI"2012-09-18T16:59:20-07:00;FI" length;Fi§èI" digest;F"%92a055c3a01f8c699d1f2f8c7de84f2dI" source;FI"§è/*! * jQuery JavaScript Library v1.7.2 * http://jquery.com/ * * Copyright 2011, John Resig * Dual licensed under the MIT or GPL Version 2 licenses. @@ -16814,10 +16814,179 @@ }; d3.time.scale.utc = function() { return d3_time_scale(d3.scale.linear(), d3_time_scaleUTCMethods, d3_time_scaleUTCFormat); }; })(); +function makeDataTable(tableObj) { + var cols = []; + var sortCols = []; + tableObj.find("th").each(function(idx, headObj) { + var classes = ($(headObj).attr('class') || "").split(/\s+/); + + if (classes.indexOf("sort-title-string") >= 0) { + cols.push({ "sType": "title-string" }); + } + else { + cols.push(null); + } + if (classes.indexOf("data-table-sort-desc") >= 0) { + sortCols.push([ idx, "desc"]); + } + else if (classes.indexOf("data-table-sort-asc") >= 0) { + sortCols.push([ idx, "asc"]); + } + }); + + var numRows = 10; + var rowRegexp = /(\d+)rows/; + var classes = (tableObj.attr('class') || "").split(/\s+/); + for (var idx = 0; idx < classes.length; idx++) { + var match = rowRegexp.exec(classes[idx]); + if (match && match.length > 1) { + numRows = parseInt(match[1]); + } + } + tableObj.dataTable({ + "sDom": "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>", + "sPaginationType": "bootstrap", + "oLanguage": { + "sLengthMenu": "_MENU_ records per page" + }, + "aoColumns": cols, + "aaSorting": sortCols, + "iDisplayLength": numRows + }); +} + +$(document).ready(function() { + // for the datatables + bootstrap tweaks, see http://datatables.net/blog/Twitter_Bootstrap_2 + + // datatables tweaks for bootstrap + $.extend($.fn.dataTableExt.oStdClasses, { + "sWrapper": "dataTables_wrapper form-inline" + }); + // sorting based on sub element with title attribute + $.fn.dataTableExt.oSort["title-string-asc"] = function(a,b) { + var aMatch = a.match(/title="(.*?)"/); + var bMatch = b.match(/title="(.*?)"/); + var x = aMatch && aMatch.length > 1 ? aMatch[1].toLowerCase() : a; + var y = bMatch && bMatch.length > 1 ? bMatch[1].toLowerCase() : b; + return ((x < y) ? -1 : ((x > y) ? 1 : 0)); + }; + $.fn.dataTableExt.oSort["title-string-desc"] = function(a,b) { + var aMatch = a.match(/title="(.*?)"/); + var bMatch = b.match(/title="(.*?)"/); + var x = aMatch && aMatch.length > 1 ? aMatch[1].toLowerCase() : a; + var y = bMatch && bMatch.length > 1 ? bMatch[1].toLowerCase() : b; + return ((x < y) ? 1 : ((x > y) ? -1 : 0)); + }; + // add row filtering based on whether the tr element has the hide css class or not + $.fn.dataTableExt.afnFiltering.push( + function(oSettings, aData, iDataIndex) { + var nTr = $(oSettings.aoData[iDataIndex].nTr); + return !nTr.hasClass("hide"); + } + ); + + // API method to get paging information + $.fn.dataTableExt.oApi.fnPagingInfo = function(oSettings) { + return { + "iStart": oSettings._iDisplayStart, + "iEnd": oSettings.fnDisplayEnd(), + "iLength": oSettings._iDisplayLength, + "iTotal": oSettings.fnRecordsTotal(), + "iFilteredTotal": oSettings.fnRecordsDisplay(), + "iPage": Math.ceil(oSettings._iDisplayStart / oSettings._iDisplayLength), + "iTotalPages": Math.ceil(oSettings.fnRecordsDisplay() / oSettings._iDisplayLength) + }; + }; + + // datatables bootstrap style pagination control + $.extend($.fn.dataTableExt.oPagination, { + "bootstrap": { + "fnInit": function(oSettings, nPaging, fnDraw) { + var oLang = oSettings.oLanguage.oPaginate; + var fnClickHandler = function(e) { + e.preventDefault(); + if (oSettings.oApi._fnPageChange(oSettings, e.data.action)) { + fnDraw(oSettings); + } + }; + + $(nPaging).addClass('pagination').append('<ul>' + '<li class="prev disabled"><a href="#">&larr; ' + oLang.sPrevious + '</a></li>' + '<li class="next disabled"><a href="#">' + oLang.sNext + ' &rarr; </a></li>' + '</ul>'); + var els = $('a', nPaging); + $(els[0]).bind('click.DT', { + action: "previous" + }, fnClickHandler); + $(els[1]).bind('click.DT', { + action: "next" + }, fnClickHandler); + }, + + "fnUpdate": function(oSettings, fnDraw) { + var iListLength = 5; + var oPaging = oSettings.oInstance.fnPagingInfo(); + var an = oSettings.aanFeatures.p; + var i, j, sClass, iStart, iEnd, iHalf = Math.floor(iListLength / 2); + + if (oPaging.iTotalPages < iListLength) { + iStart = 1; + iEnd = oPaging.iTotalPages; + } else if (oPaging.iPage <= iHalf) { + iStart = 1; + iEnd = iListLength; + } else if (oPaging.iPage >= (oPaging.iTotalPages - iHalf)) { + iStart = oPaging.iTotalPages - iListLength + 1; + iEnd = oPaging.iTotalPages; + } else { + iStart = oPaging.iPage - iHalf + 1; + iEnd = iStart + iListLength - 1; + } + + for (i = 0, iLen = an.length; i < iLen; i++) { + // Remove the middle elements + $('li:gt(0)', an[i]).filter(':not(:last)').remove(); + + // Add the new list items and their event handlers + for (j = iStart; j <= iEnd; j++) { + sClass = (j == oPaging.iPage + 1) ? 'class="active"' : ''; + $('<li ' + sClass + '><a href="#">' + j + '</a></li>').insertBefore($('li:last', an[i])[0]).bind('click', function(e) { + e.preventDefault(); + oSettings._iDisplayStart = (parseInt($('a', this).text(), 10) - 1) * oPaging.iLength; + fnDraw(oSettings); + }); + } + + // Add / remove disabled classes from the static elements + if (oPaging.iPage === 0) { + $('li:first', an[i]).addClass('disabled'); + } else { + $('li:first', an[i]).removeClass('disabled'); + } + + if (oPaging.iPage === oPaging.iTotalPages - 1 || oPaging.iTotalPages === 0) { + $('li:last', an[i]).addClass('disabled'); + } else { + $('li:last', an[i]).removeClass('disabled'); + } + } + } + } + }); + + // make any table with css class data-table a datatable + $("table.data-table").each(function() { + makeDataTable($(this)); + }); + + // make any input field with css class date-picker a datepicker + $("input.date-picker").each(function() { + $(this).datepicker({ + format: 'yyyy-mm-dd' + }); + }); +}); // Restrict numeric input for a text field // TODO - consider switching to HTML5's <input type="number" /> function preventNonNumericValues(event) { // Allow: backspace, delete, tab, escape, and enter if (event.keyCode == 46 || event.keyCode == 8 || event.keyCode == 9 || event.keyCode == 27 || event.keyCode == 13 || @@ -16926,7 +17095,8 @@ + ; -;TI"required_assets_digest;F"%f053dd4ba98234602421d71989caa576I" _version;F"%9f3b95dd7ea3030dc35985c0a8020862 +;TI"required_assets_digest;F"%e77fbb48af6f40fe26859802935e8488I" _version;F"%9f3b95dd7ea3030dc35985c0a8020862 \ No newline at end of file