o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1361449320.3019001RU: @value" {I" class:EFI"BundledAsset;FI"logical_path;FI"4iugu-ux/components/usecode/iugu-ui-paginator.js;FI" pathname;FI"‘/Users/patricknegri/.rvm/gems/ruby-1.9.2-p290/gems/iugu-ux-0.9.2/vendor/assets/javascripts/iugu-ux/components/usecode/iugu-ui-paginator.js.coffee;FI"content_type;FI"application/javascript;FI" mtime;FI"2013-01-17T19:18:49-02:00;FI" length;FiË I" digest;F"%a3625891bb4dd2c18a8d7711c16a913dI" 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); ;FI"required_assets_digest;F"%d4b30464590895326acd3ca7aaf517ddI" _version;F"%6776f581a4329e299531e1d52aa59832