Skip to content

Commit

Permalink
Bump version to 0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandernst committed Dec 25, 2012
1 parent 89169b0 commit 2c061be
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 14 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ Backbone.Paginator is a set of opinionated components for paginating collections

You can either download the raw source code for the project, fork the repository or use one of these links:

* Production: [production version][min] 3.3K file size (1.1K gzipped)
* Development: [development version][max] 7.01K file size (2.28K gzipped)
* Production: [production version][min] 10.2K file size (2.79K gzipped)
* Development: [development version][max] 30.1K file size (6.8K gzipped)
* Examples: [tarball](https://github.com/addyosmani/backbone.paginator/zipball/)

[min]: https://raw.github.com/addyosmani/backbone.paginator/master/dist/backbone.paginator.min.js
Expand Down Expand Up @@ -464,8 +464,8 @@ _Also, please don't edit files in the "dist" subdirectory as they are generated
There have been a number of significant API changes made to the Paginator since it was first released. A stable release (with up to date documentation) will be available soon, complete with updated unit tests.
* 0.next - improved unit testing, demos
* 0.current - improved sorting and add filtering abilities. Add setSort() and setFilter() methods. Make pager() argument-less. Don't force attributes. Let the developer change the type of the request. Make the API cleaner. Some bug fixes.
* 0.next - ...
* 0.5 - improved unit testing, demos, sorting. Added filtering abilities. Added setSort() and setFilter() methods. Make pager() argument-less. Don't force attributes. Let the developer change the type of the request. Make the API cleaner. Some bug fixes.
* 0.15 - rewrite to simplify the project API, unify components under the same collection hood
* 0.14 - rewrite of all components
* 0.13 - initial release of client and request pagers
Expand Down
61 changes: 54 additions & 7 deletions dist/backbone.paginator.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*! backbone.paginator - v0.1.54 - 12/17/2012
/*! backbone.paginator - v0.1.54 - 12/25/2012
* http://github.com/addyosmani/backbone.paginator
* Copyright (c) 2012 Addy Osmani; Licensed MIT */

Backbone.Paginator = (function ( Backbone, _, $ ) {
"use strict";

var Paginator = {};
Paginator.version = "0.15";
Paginator.version = "0.5";

// @name: clientPager
//
Expand Down Expand Up @@ -78,7 +78,7 @@ Backbone.Paginator = (function ( Backbone, _, $ ) {
// Some values could be functions, let's make sure
// to change their scope too and run them
var queryAttributes = {};
_.each(self.server_api, function(value, key){
_.each(_.result(self, "server_api"), function(value, key){
if( _.isFunction(value) ) {
value = _.bind(value, self);
value = value();
Expand All @@ -103,13 +103,37 @@ Backbone.Paginator = (function ( Backbone, _, $ ) {
dataType: 'jsonp'
});

var success = options.success;
options.success = function ( resp, status, xhr ) {
if ( success ) {
success( resp, status, xhr );
}
if ( model && model.trigger ) {
model.trigger( 'sync', model, resp, options );
}
};

var error = options.error;
options.error = function ( xhr, status, thrown ) {
if ( error ) {
error( model, xhr, options );
}
if ( model && model.trigger ) {
model.trigger( 'error', model, xhr, options );
}
};

queryOptions = _.extend(queryOptions, {
data: decodeURIComponent($.param(queryAttributes)),
processData: false,
url: _.result(queryOptions, 'url')
}, options);

return $.ajax( queryOptions );
var xhr = $.ajax( queryOptions );
if ( model && model.trigger ) {
model.trigger('request', model, xhr, options);
}
return xhr;
},

nextPage: function () {
Expand Down Expand Up @@ -735,7 +759,7 @@ Backbone.Paginator = (function ( Backbone, _, $ ) {
// Some values could be functions, let's make sure
// to change their scope too and run them
var queryAttributes = {};
_.each(self.server_api, function(value, key){
_.each(_.result(self, "server_api"), function(value, key){
if( _.isFunction(value) ) {
value = _.bind(value, self);
value = value();
Expand Down Expand Up @@ -767,13 +791,36 @@ Backbone.Paginator = (function ( Backbone, _, $ ) {
options.data = decodeURIComponent($.param(queryAttributes));
}

var success = options.success;
options.success = function ( resp, status, xhr ) {
if ( success ) {
success( resp, status, xhr );
}
if ( model && model.trigger ) {
model.trigger( 'sync', model, resp, options );
}
};

var error = options.error;
options.error = function ( xhr, status, thrown ) {
if ( error ) {
error( model, xhr, options );
}
if ( model && model.trigger ) {
model.trigger( 'error', model, xhr, options );
}
};

queryOptions = _.extend(queryOptions, {
processData: false,
url: _.result(queryOptions, 'url')
}, options);

return $.ajax( queryOptions );

var xhr = $.ajax( queryOptions );
if ( model && model.trigger ) {
model.trigger('request', model, xhr, options);
}
return xhr;
},

requestNextPage: function ( options ) {
Expand Down
Loading

0 comments on commit 2c061be

Please sign in to comment.