backbone-relational-rails 0.9.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/backbone-relational-rails/version.rb +1 -1
- data/vendor/assets/javascripts/backbone-relational.js +19 -20
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c8dbc5405ae4a822d233b7ba0b6f940d66ff832
|
4
|
+
data.tar.gz: 6111d454236a0d947397a12cd2b1366beddab57b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf956a0cc739752ac2d118b955d5c4e0f64d492df329b52f4c663ba1f2278f9a3bcb96b6ac93914e0258bac97a65b6f8e48b4e2c98c83d0d7075e9e0631a1e2a
|
7
|
+
data.tar.gz: 56770aafb540f06ef3acb27c18cb22642f474f36be9ce03bc854585cc192731300817b21324cf9861607b8095a33b09db9231eaaf60f6cb47bb49407e27c2a3f
|
data/README.md
CHANGED
@@ -18,7 +18,7 @@ Add the following directive to your Javascript manifest file (application.js):
|
|
18
18
|
|
19
19
|
## Versioning
|
20
20
|
|
21
|
-
backbone-relational-rails 0.
|
21
|
+
backbone-relational-rails 0.10.0 == Backbone-relational 0.10.0
|
22
22
|
|
23
23
|
Every attempt is made to mirror the currently shipping Backbone-relational version number wherever possible.
|
24
24
|
The major, minor, and patch version numbers will always represent the Backbone-relational version. Should a gem
|
@@ -26,7 +26,7 @@ bug be discovered, a 4th version identifier will be added and incremented.
|
|
26
26
|
|
27
27
|
## Backbone Version
|
28
28
|
|
29
|
-
This release of Backbone-relational is only compatible with Backbone >= 1.1.
|
29
|
+
This release of Backbone-relational is only compatible with Backbone >= 1.2.1.
|
30
30
|
|
31
31
|
## Acknowledgements
|
32
32
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* vim: set tabstop=4 softtabstop=4 shiftwidth=4 noexpandtab: */
|
2
2
|
/**
|
3
|
-
* Backbone-relational.js 0.
|
3
|
+
* Backbone-relational.js 0.10.0
|
4
4
|
* (c) 2011-2014 Paul Uithol and contributors (https://github.com/PaulUithol/Backbone-relational/graphs/contributors)
|
5
5
|
*
|
6
6
|
* Backbone-relational may be freely distributed under the MIT license; see the accompanying LICENSE.txt.
|
@@ -1022,9 +1022,8 @@
|
|
1022
1022
|
}
|
1023
1023
|
else {
|
1024
1024
|
// If `merge` is true, update models here, instead of during update.
|
1025
|
-
model = this.relatedModel.
|
1026
|
-
_.
|
1027
|
-
);
|
1025
|
+
model = ( _.isObject( attributes ) && options.parse && this.relatedModel.prototype.parse ) ?
|
1026
|
+
this.relatedModel.prototype.parse( _.clone( attributes ), options ) : attributes;
|
1028
1027
|
}
|
1029
1028
|
|
1030
1029
|
model && toAdd.push( model );
|
@@ -1037,9 +1036,9 @@
|
|
1037
1036
|
related = this._prepareCollection();
|
1038
1037
|
}
|
1039
1038
|
|
1040
|
-
// By now,
|
1041
|
-
// Disable
|
1042
|
-
related.set( toAdd, _.defaults( {
|
1039
|
+
// By now, `parse` will already have been executed just above for models if specified.
|
1040
|
+
// Disable to prevent additional calls.
|
1041
|
+
related.set( toAdd, _.defaults( { parse: false }, options ) );
|
1043
1042
|
}
|
1044
1043
|
|
1045
1044
|
// Remove entries from `keyIds` that were already part of the relation (and are thus 'unchanged')
|
@@ -1238,7 +1237,7 @@
|
|
1238
1237
|
var dit = this,
|
1239
1238
|
args = arguments;
|
1240
1239
|
|
1241
|
-
if ( !Backbone.Relational.eventQueue.
|
1240
|
+
if ( !Backbone.Relational.eventQueue.isBlocked() ) {
|
1242
1241
|
// If we're not in a more complicated nested scenario, fire the change event right away
|
1243
1242
|
Backbone.Model.prototype.trigger.apply( dit, args );
|
1244
1243
|
}
|
@@ -1494,12 +1493,16 @@
|
|
1494
1493
|
}
|
1495
1494
|
}
|
1496
1495
|
|
1497
|
-
return
|
1496
|
+
return this.deferArray(requests).then(
|
1498
1497
|
function() {
|
1499
1498
|
return Backbone.Model.prototype.get.call( dit, attr );
|
1500
1499
|
}
|
1501
1500
|
);
|
1502
1501
|
},
|
1502
|
+
|
1503
|
+
deferArray: function(deferArray) {
|
1504
|
+
return Backbone.$.when.apply(null, deferArray);
|
1505
|
+
},
|
1503
1506
|
|
1504
1507
|
set: function( key, value, options ) {
|
1505
1508
|
Backbone.Relational.eventQueue.block();
|
@@ -1827,7 +1830,7 @@
|
|
1827
1830
|
findOrCreate: function( attributes, options ) {
|
1828
1831
|
options || ( options = {} );
|
1829
1832
|
var parsedAttributes = ( _.isObject( attributes ) && options.parse && this.prototype.parse ) ?
|
1830
|
-
this.prototype.parse( _.clone( attributes ) ) : attributes;
|
1833
|
+
this.prototype.parse( _.clone( attributes ), options ) : attributes;
|
1831
1834
|
|
1832
1835
|
// If specified, use a custom `find` function to match up existing models to the given attributes.
|
1833
1836
|
// Otherwise, try to find an instance of 'this' model type in the store
|
@@ -1974,20 +1977,16 @@
|
|
1974
1977
|
};
|
1975
1978
|
|
1976
1979
|
/**
|
1977
|
-
* Override 'Backbone.Collection.
|
1980
|
+
* Override 'Backbone.Collection._removeModels' to trigger 'relational:remove'.
|
1978
1981
|
*/
|
1979
|
-
var
|
1980
|
-
Backbone.Collection.prototype.
|
1982
|
+
var _removeModels = Backbone.Collection.prototype.___removeModels = Backbone.Collection.prototype._removeModels;
|
1983
|
+
Backbone.Collection.prototype._removeModels = function( models, options ) {
|
1981
1984
|
// Short-circuit if this Collection doesn't hold RelationalModels
|
1982
1985
|
if ( !( this.model.prototype instanceof Backbone.RelationalModel ) ) {
|
1983
|
-
return
|
1986
|
+
return _removeModels.call( this, models, options );
|
1984
1987
|
}
|
1985
1988
|
|
1986
|
-
var
|
1987
|
-
toRemove = [];
|
1988
|
-
|
1989
|
-
models = singular ? ( models ? [ models ] : [] ) : _.clone( models );
|
1990
|
-
options || ( options = {} );
|
1989
|
+
var toRemove = [];
|
1991
1990
|
|
1992
1991
|
//console.debug('calling remove on coll=%o; models=%o, options=%o', this, models, options );
|
1993
1992
|
_.each( models, function( model ) {
|
@@ -1995,7 +1994,7 @@
|
|
1995
1994
|
model && toRemove.push( model );
|
1996
1995
|
}, this );
|
1997
1996
|
|
1998
|
-
var result =
|
1997
|
+
var result = _removeModels.call( this, toRemove, options );
|
1999
1998
|
|
2000
1999
|
_.each( toRemove, function( model ) {
|
2001
2000
|
this.trigger( 'relational:remove', model, this, options );
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: backbone-relational-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Marsh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -63,4 +63,3 @@ signing_key:
|
|
63
63
|
specification_version: 4
|
64
64
|
summary: Backbone-relational packaged for Rails
|
65
65
|
test_files: []
|
66
|
-
has_rdoc:
|