js_stack 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  /*
2
- backbone-pageable 1.4.3
3
- http://github.com/wyuenho/backbone-pageable
2
+ backbone-pageable 1.4.5
3
+ http://github.com/backbone-paginator/backbone-pageable
4
4
 
5
5
  Copyright (c) 2013 Jimmy Yuen Ho Wong
6
6
  Licensed under the MIT @license.
@@ -944,16 +944,10 @@
944
944
  links from them for infinite paging.
945
945
 
946
946
  This default implementation parses the RFC 5988 `Link` header and extract
947
- 3 links from it - `first`, `prev`, `next`. If a `previous` link is found,
948
- it will be found in the `prev` key in the returned object hash. Any
949
- subclasses overriding this method __must__ return an object hash having
950
- only the keys above. If `first` is missing, the collection's default URL
951
- is assumed to be the `first` URL. If `prev` or `next` is missing, it is
952
- assumed to be `null`. An empty object hash must be returned if there are
953
- no links found. If either the response or the header contains information
954
- pertaining to the total number of records on the server, #state.totalRecords
955
- must be set to that number. The default implementation uses the `last`
956
- link from the header to calculate it.
947
+ 3 links from it - `first`, `prev`, `next`. Any subclasses overriding this
948
+ method __must__ return an object hash having only the keys
949
+ above. However, simply returning a `next` link or an empty hash if there
950
+ are no more links should be enough for most implementations.
957
951
 
958
952
  @param {*} resp The deserialized response body.
959
953
  @param {Object} [options]
@@ -965,7 +959,7 @@
965
959
  var links = {};
966
960
  var linkHeader = options.xhr.getResponseHeader("Link");
967
961
  if (linkHeader) {
968
- var relations = ["first", "prev", "previous", "next", "last"];
962
+ var relations = ["first", "prev", "next"];
969
963
  _each(linkHeader.split(","), function (linkValue) {
970
964
  var linkParts = linkValue.split(";");
971
965
  var url = linkParts[0].replace(URL_TRIM_RE, '');
@@ -974,40 +968,11 @@
974
968
  var paramParts = param.split("=");
975
969
  var key = paramParts[0].replace(PARAM_TRIM_RE, '');
976
970
  var value = paramParts[1].replace(PARAM_TRIM_RE, '');
977
- if (key == "rel" && _contains(relations, value)) {
978
- if (value == "previous") links.prev = url;
979
- else links[value] = url;
980
- }
971
+ if (key == "rel" && _contains(relations, value)) links[value] = url;
981
972
  });
982
973
  });
983
-
984
- var last = links.last || '', qsi, qs;
985
- if (qs = (qsi = last.indexOf('?')) ? last.slice(qsi + 1) : '') {
986
- var params = queryStringToParams(qs);
987
-
988
- var state = _clone(this.state);
989
- var queryParams = this.queryParams;
990
- var pageSize = state.pageSize;
991
-
992
- var totalRecords = params[queryParams.totalRecords] * 1;
993
- var pageNum = params[queryParams.currentPage] * 1;
994
- var totalPages = params[queryParams.totalPages];
995
-
996
- if (!totalRecords) {
997
- if (pageNum) totalRecords = (state.firstPage === 0 ?
998
- pageNum + 1 :
999
- pageNum) * pageSize;
1000
- else if (totalPages) totalRecords = totalPages * pageSize;
1001
- }
1002
-
1003
- if (totalRecords) state.totalRecords = totalRecords;
1004
-
1005
- this.state = this._checkState(state);
1006
- }
1007
974
  }
1008
975
 
1009
- delete links.last;
1010
-
1011
976
  return links;
1012
977
  },
1013
978
 
@@ -1051,7 +1016,8 @@
1051
1016
  },
1052
1017
 
1053
1018
  /**
1054
- Parse server response for server pagination state updates.
1019
+ Parse server response for server pagination state updates. Not applicable
1020
+ under infinite mode.
1055
1021
 
1056
1022
  This default implementation first checks whether the response has any
1057
1023
  state object as documented in #parse. If it exists, a state object is
@@ -1213,7 +1179,8 @@
1213
1179
  var models = col.models;
1214
1180
  if (mode == "client") fullCol.reset(models, opts);
1215
1181
  else {
1216
- fullCol.add(models, _extend({at: fullCol.length}, opts));
1182
+ fullCol.add(models, _extend({at: fullCol.length},
1183
+ _extend(opts, {parse: false})));
1217
1184
  self.trigger("reset", self, opts);
1218
1185
  }
1219
1186
 
@@ -1 +1 @@
1
- //= require js_stack/backbone.pageable/backbone.pageable-1.4.3
1
+ //= require js_stack/backbone.pageable/backbone.pageable-1.4.5
@@ -1,6 +1,6 @@
1
- // Backbone.Validation v0.9.0
1
+ // Backbone.Validation v0.9.1
2
2
  //
3
- // Copyright (c) 2011-2013 Thomas Pedersen
3
+ // Copyright (c) 2011-2014 Thomas Pedersen
4
4
  // Distributed under MIT License
5
5
  //
6
6
  // Documentation and full license available at:
@@ -305,7 +305,7 @@ Backbone.Validation = (function(_){
305
305
  return {
306
306
 
307
307
  // Current version of the library
308
- version: '0.9.0',
308
+ version: '0.9.1',
309
309
 
310
310
  // Called to configure the default options
311
311
  configure: function(options) {
@@ -347,7 +347,7 @@ Backbone.Validation = (function(_){
347
347
  if(model) {
348
348
  unbindModel(model);
349
349
  }
350
- if(collection) {
350
+ else if(collection) {
351
351
  collection.each(function(model){
352
352
  unbindModel(model);
353
353
  });
@@ -1 +1 @@
1
- //= require js_stack/backbone.validation/backbone.validation-0.9.0
1
+ //= require js_stack/backbone.validation/backbone.validation-0.9.1