o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1357654409.4920561}Ù: @value"Š {I" class:EFI"ProcessedAsset;FI"logical_path;FI"4iugu-ux/components/usecode/iugu-ui-paginator.js;FI" pathname;FI"|/Users/patricknegri/Desenvolvimento/iugu-ux/vendor/assets/javascripts/iugu-ux/components/usecode/iugu-ui-paginator.js.coffee;FI"content_type;FI"application/javascript;FI" mtime;FI"2013-01-08T11:07:36-02:00;FI" length;FiË I" digest;F"%2def3b39fbefc6fb3f31c074eb37c63cI" source;FI"Ë (function() { var __hasProp = {}.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; IuguUI.Paginator = (function(_super) { __extends(Paginator, _super); function Paginator() { return Paginator.__super__.constructor.apply(this, arguments); } Paginator.prototype.layout = "iugu-ui-paginator"; Paginator.prototype.defaults = { numberOfPageButtons: 9, enableAdditionalButtons: true }; Paginator.prototype.events = { 'click a.page': 'gotoPage', 'click a.next': function() { this.handleEvent('next'); return false; }, 'click a.previous': function() { this.handleEvent('previous'); return false; } }; Paginator.prototype.initialize = function() { return Paginator.__super__.initialize.apply(this, arguments); }; Paginator.prototype.context = function() { return { currentPage: 1, firstPage: 1, lastPage: 1, enableAdditionalButtons: this.options.enableAdditionalButtons, pageButtons: this.pageButtonsToShow(10, 1, 10, 1) }; }; Paginator.prototype.currentPage = 1; Paginator.prototype.gotoPage = function(e) { e.preventDefault(); if ($(e.target).text() === '...') { return; } this.currentPage = $(e.target).text(); return this.handleEvent('change-page'); }; Paginator.prototype.pageButtonsToShow = function(numberOfButtons, firstPage, totalPages, currentPage) { var begin, end, offset, surrounding; if (!totalPages) { return; } if (numberOfButtons > totalPages) { return _.range(2, totalPages); } surrounding = (numberOfButtons - 3) / 2; begin = currentPage - Math.floor(surrounding); end = currentPage + Math.ceil(surrounding); if (begin <= firstPage + 1) { offset = firstPage + 1 - begin; begin += offset; end += offset; } else if (end >= totalPages - 1) { offset = totalPages - end - 1; begin += offset; end += offset; } return _.range(begin, end + 1); }; return Paginator; })(IuguUI.Base); this.IuguUI.Paginator = IuguUI.Paginator; }).call(this); ;TI"dependency_digest;F"%ff3211b0e70097a6e459a5ed29939bc4I"required_paths;F[I"|/Users/patricknegri/Desenvolvimento/iugu-ux/vendor/assets/javascripts/iugu-ux/components/usecode/iugu-ui-paginator.js.coffee;FI"dependency_paths;F[{I" path;FI"|/Users/patricknegri/Desenvolvimento/iugu-ux/vendor/assets/javascripts/iugu-ux/components/usecode/iugu-ui-paginator.js.coffee;FI" mtime;FI"2013-01-08T11:07:36-02:00;FI" digest;F"%29584769563ed615079e1d6f9595844aI" _version;F"%9f3b95dd7ea3030dc35985c0a8020862