js_stack 0.6.7 → 0.6.8
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +6 -6
- data/lib/js_stack/version.rb +1 -1
- data/vendor/assets/javascripts/js_stack/base/marionette/{2.0.1.js → 2.0.3.js} +41 -25
- data/vendor/assets/javascripts/js_stack/base/marionette.js +1 -1
- data/vendor/assets/javascripts/js_stack/plugins/backbone/paginator/{2.0.1.js → 2.0.2.js} +3 -3
- data/vendor/assets/javascripts/js_stack/plugins/backbone/virtualcollection/0.5.0.js +204 -0
- data/vendor/assets/javascripts/js_stack/plugins/backbone.paginator.js +1 -1
- data/vendor/assets/javascripts/js_stack/plugins/backbone.virtualcollection.js +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 76c185bc4f7a94369ab13fa9482415f86a1f331b
|
|
4
|
+
data.tar.gz: bc92abb38284758ebec53d1a48d89e1fc419a8e3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b33aa6b7e27f9811e669c8b0f53ac88c4efb74615ce3f57061fb068d6372cc35ad1c9123712cebe0b977b6fbb8820aef64c4aaee9f73a355780bf9ec1784a331
|
|
7
|
+
data.tar.gz: 178e838a1992bea00634e29ae64bc2795d675f0877c0b4ed37275a5a377bf9596741be699268fb7c97e4149ce7fb4173f3539b0907011ae0899e7fec8afe56d2
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# js_stack [](https://gemnasium.com/netguru/js_stack) [](http://badge.fury.io/rb/js_stack)
|
|
2
2
|
|
|
3
3
|
Standard JS SPA stack we use at netguru
|
|
4
4
|
|
|
@@ -53,10 +53,10 @@ Examples:
|
|
|
53
53
|
| Library | Versions | Changelog | Homepage |
|
|
54
54
|
| :-----: | :------: | :-------: | :------: |
|
|
55
55
|
| backbone | **1.1.2**, 1.0.0 | [changelog](http://backbonejs.org/#changelog) | [homepage](http://backbonejs.org/) |
|
|
56
|
-
| marionette | **2.0.
|
|
56
|
+
| marionette | **2.0.3**, 1.8.8, 1.7.4, 1.6.4, 1.5.1, 1.4.1, 1.1.0 | [changelog](https://github.com/marionettejs/backbone.marionette/blob/master/changelog.md) | [homepage](http://marionettejs.com/) |
|
|
57
57
|
| underscore | **1.6.0**, 1.5.2 | [changelog](http://underscorejs.org/#changelog) | [homepage](http://underscorejs.org/) |
|
|
58
58
|
| hamlcoffee | **1.16** | [changelog](https://github.com/netzpirat/haml_coffee_assets/blob/master/CHANGELOG.md) | [homepage](https://github.com/netzpirat/haml_coffee_assets) |
|
|
59
|
-
| js-routes | **0.9.8** |
|
|
59
|
+
| js-routes | **0.9.8** | [changelog](https://github.com/railsware/js-routes/blob/master/CHANGELOG.md) | [homepage](https://github.com/railsware/js-routes) |
|
|
60
60
|
|
|
61
61
|
### Plugins
|
|
62
62
|
|
|
@@ -66,13 +66,13 @@ Examples:
|
|
|
66
66
|
| backbone deepmodel | **0.10.4** | [changelog](https://github.com/powmedia/backbone-deep-model#changelog) | [homepage](https://github.com/powmedia/backbone-deep-model) | Yes
|
|
67
67
|
| backbone mutators | **0.4.2** | [changelog](https://github.com/asciidisco/Backbone.Mutators#changelog) | [homepage](https://github.com/asciidisco/Backbone.Mutators) | No
|
|
68
68
|
| backbone pageable | **1.4.8**, 1.3.2 | [changelog](https://github.com/backbone-paginator/backbone-pageable#change-log) | [homepage](https://github.com/wyuenho/backbone-pageable) | Yes
|
|
69
|
-
| backbone paginator | **2.0.
|
|
69
|
+
| backbone paginator | **2.0.2** | [changelog](https://github.com/backbone-paginator/backbone.paginator/wiki/Changelog) | [homepage](https://github.com/backbone-paginator/backbone.paginator) | No
|
|
70
70
|
| backbone routefilter | **0.2.1** | [changelog](https://github.com/boazsender/backbone.routefilter#release-history) | [homepage](https://github.com/boazsender/backbone.routefilter) | No
|
|
71
71
|
| backbone stickit | **0.8.0**, 0.7.0, 0.6.3 | [changelog](http://nytimes.github.io/backbone.stickit/#change-log) | [homepage](http://nytimes.github.io/backbone.stickit/) | Yes
|
|
72
72
|
| backbone validation | **0.9.1**, 0.8.1 | [changelog](https://github.com/thedersen/backbone.validation#release-notes) | [homepage](https://github.com/thedersen/backbone.validation) | Yes
|
|
73
|
-
| backbone virtualcollection | **0.4.15
|
|
73
|
+
| backbone virtualcollection | **0.5.0**, 0.4.15 | [changelog](https://github.com/p3drosola/Backbone.VirtualCollection#changelog) | [homepage](https://github.com/p3drosola/Backbone.VirtualCollection) | Yes
|
|
74
74
|
| cocktail | **0.5.8** | none | [homepage](https://github.com/onsi/cocktail) | No
|
|
75
|
-
| momentjs | **2.7.0** | [changelog](https://github.com/moment/moment
|
|
75
|
+
| momentjs | **2.7.0** | [changelog](https://github.com/moment/moment/blob/develop/CHANGELOG.md) | [homepage](https://github.com/derekprior/momentjs-rails) | No
|
|
76
76
|
| underscore inflections | **0.2.1** | none | [homepage](https://github.com/geetarista/underscore.inflections) | No
|
|
77
77
|
| underscore string | **2.3.2** | [changelog](https://github.com/epeli/underscore.string#changelog) | [homepage](http://epeli.github.io/underscore.string/) | No
|
|
78
78
|
> Default: library is included in `js_stack/plugins`
|
data/lib/js_stack/version.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// MarionetteJS (Backbone.Marionette)
|
|
2
2
|
// ----------------------------------
|
|
3
|
-
// v2.0.
|
|
3
|
+
// v2.0.3
|
|
4
4
|
//
|
|
5
5
|
// Copyright (c)2014 Derick Bailey, Muted Solutions, LLC.
|
|
6
6
|
// Distributed under MIT license
|
|
@@ -489,7 +489,7 @@
|
|
|
489
489
|
|
|
490
490
|
var Marionette = Backbone.Marionette = {};
|
|
491
491
|
|
|
492
|
-
Marionette.VERSION = '2.0.
|
|
492
|
+
Marionette.VERSION = '2.0.3';
|
|
493
493
|
|
|
494
494
|
Marionette.noConflict = function() {
|
|
495
495
|
root.Marionette = previousMarionette;
|
|
@@ -589,7 +589,7 @@
|
|
|
589
589
|
// Mix in methods from Underscore, for iteration, and other
|
|
590
590
|
// collection related features.
|
|
591
591
|
// Borrowing this code from Backbone.Collection:
|
|
592
|
-
// http://backbonejs.org/docs/backbone.html#section-
|
|
592
|
+
// http://backbonejs.org/docs/backbone.html#section-121
|
|
593
593
|
Marionette.actAsCollection = function(object, listProperty) {
|
|
594
594
|
var methods = ['forEach', 'each', 'map', 'find', 'detect', 'filter',
|
|
595
595
|
'select', 'reject', 'every', 'all', 'some', 'any', 'include',
|
|
@@ -855,7 +855,6 @@
|
|
|
855
855
|
// modules and routers, and as a mediator for workflow
|
|
856
856
|
// and coordination of other objects, views, and more.
|
|
857
857
|
Marionette.Controller = function(options) {
|
|
858
|
-
this.triggerMethod = Marionette.triggerMethod;
|
|
859
858
|
this.options = options || {};
|
|
860
859
|
|
|
861
860
|
if (_.isFunction(this.initialize)) {
|
|
@@ -888,7 +887,7 @@
|
|
|
888
887
|
|
|
889
888
|
});
|
|
890
889
|
|
|
891
|
-
/* jshint maxcomplexity: 10, maxstatements:
|
|
890
|
+
/* jshint maxcomplexity: 10, maxstatements: 29 */
|
|
892
891
|
|
|
893
892
|
// Region
|
|
894
893
|
// ------
|
|
@@ -1044,6 +1043,13 @@
|
|
|
1044
1043
|
var _shouldShowView = isDifferentView || forceShow;
|
|
1045
1044
|
|
|
1046
1045
|
if (_shouldShowView) {
|
|
1046
|
+
|
|
1047
|
+
// We need to listen for if a view is destroyed
|
|
1048
|
+
// in a way other than through the region.
|
|
1049
|
+
// If this happens we need to remove the reference
|
|
1050
|
+
// to the currentView since once a view has been destroyed
|
|
1051
|
+
// we can not reuse it.
|
|
1052
|
+
view.once('destroy', _.bind(this.empty, this));
|
|
1047
1053
|
view.render();
|
|
1048
1054
|
|
|
1049
1055
|
if (isChangingView) {
|
|
@@ -1051,7 +1057,12 @@
|
|
|
1051
1057
|
}
|
|
1052
1058
|
|
|
1053
1059
|
this.triggerMethod('before:show', view);
|
|
1054
|
-
|
|
1060
|
+
|
|
1061
|
+
if (_.isFunction(view.triggerMethod)) {
|
|
1062
|
+
view.triggerMethod('before:show');
|
|
1063
|
+
} else {
|
|
1064
|
+
this.triggerMethod.call(view, 'before:show');
|
|
1065
|
+
}
|
|
1055
1066
|
|
|
1056
1067
|
this.attachHtml(view);
|
|
1057
1068
|
this.currentView = view;
|
|
@@ -1103,19 +1114,31 @@
|
|
|
1103
1114
|
// current view, it does nothing and returns immediately.
|
|
1104
1115
|
empty: function() {
|
|
1105
1116
|
var view = this.currentView;
|
|
1106
|
-
if (!view || view.isDestroyed) { return; }
|
|
1107
1117
|
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
if (view.destroy) { view.destroy(); }
|
|
1112
|
-
else if (view.remove) { view.remove(); }
|
|
1118
|
+
// If there is no view in the region
|
|
1119
|
+
// we should not remove anything
|
|
1120
|
+
if (!view) { return; }
|
|
1113
1121
|
|
|
1122
|
+
this.triggerMethod('before:empty', view);
|
|
1123
|
+
this._destroyView();
|
|
1114
1124
|
this.triggerMethod('empty', view);
|
|
1115
1125
|
|
|
1126
|
+
// Remove region pointer to the currentView
|
|
1116
1127
|
delete this.currentView;
|
|
1117
1128
|
},
|
|
1118
1129
|
|
|
1130
|
+
// call 'destroy' or 'remove', depending on which is found
|
|
1131
|
+
// on the view (if showing a raw Backbone view or a Marionette View)
|
|
1132
|
+
_destroyView: function() {
|
|
1133
|
+
var view = this.currentView;
|
|
1134
|
+
|
|
1135
|
+
if (view.destroy && !view.isDestroyed) {
|
|
1136
|
+
view.destroy();
|
|
1137
|
+
} else if (view.remove) {
|
|
1138
|
+
view.remove();
|
|
1139
|
+
}
|
|
1140
|
+
},
|
|
1141
|
+
|
|
1119
1142
|
// Attach an existing view to the region. This
|
|
1120
1143
|
// will not call `render` or `onShow` for the new view,
|
|
1121
1144
|
// and will not replace the current HTML for the `el`
|
|
@@ -1855,20 +1878,18 @@
|
|
|
1855
1878
|
// more control over events being triggered, around the rendering
|
|
1856
1879
|
// process
|
|
1857
1880
|
_renderChildren: function() {
|
|
1858
|
-
this.startBuffering();
|
|
1859
|
-
|
|
1860
1881
|
this.destroyEmptyView();
|
|
1861
1882
|
this.destroyChildren();
|
|
1862
1883
|
|
|
1863
|
-
if (
|
|
1884
|
+
if (this.isEmpty(this.collection)) {
|
|
1885
|
+
this.showEmptyView();
|
|
1886
|
+
} else {
|
|
1864
1887
|
this.triggerMethod('before:render:collection', this);
|
|
1888
|
+
this.startBuffering();
|
|
1865
1889
|
this.showCollection();
|
|
1890
|
+
this.endBuffering();
|
|
1866
1891
|
this.triggerMethod('render:collection', this);
|
|
1867
|
-
} else {
|
|
1868
|
-
this.showEmptyView();
|
|
1869
1892
|
}
|
|
1870
|
-
|
|
1871
|
-
this.endBuffering();
|
|
1872
1893
|
},
|
|
1873
1894
|
|
|
1874
1895
|
// Internal method to loop through collection and show each child view.
|
|
@@ -2605,12 +2626,7 @@
|
|
|
2605
2626
|
// Wraps several of the view's methods
|
|
2606
2627
|
// calling the methods first on each behavior
|
|
2607
2628
|
// and then eventually calling the method on the view.
|
|
2608
|
-
Behaviors.wrap(view, behaviors,
|
|
2609
|
-
'bindUIElements', 'unbindUIElements',
|
|
2610
|
-
'delegateEvents', 'undelegateEvents',
|
|
2611
|
-
'behaviorEvents', 'triggerMethod',
|
|
2612
|
-
'setElement', 'destroy'
|
|
2613
|
-
]);
|
|
2629
|
+
Behaviors.wrap(view, behaviors, _.keys(methods));
|
|
2614
2630
|
}
|
|
2615
2631
|
|
|
2616
2632
|
var methods = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
//= require js_stack/base/marionette/2.0.
|
|
1
|
+
//= require js_stack/base/marionette/2.0.3
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
backbone.paginator 2.0.
|
|
2
|
+
backbone.paginator 2.0.2
|
|
3
3
|
http://github.com/backbone-paginator/backbone.paginator
|
|
4
4
|
|
|
5
5
|
Copyright (c) 2013 Jimmy Yuen Ho Wong and contributors
|
|
@@ -63,7 +63,6 @@
|
|
|
63
63
|
var _isObject = _.isObject;
|
|
64
64
|
var _keys = _.keys;
|
|
65
65
|
var _isUndefined = _.isUndefined;
|
|
66
|
-
var _result = _.result;
|
|
67
66
|
var ceil = Math.ceil;
|
|
68
67
|
var floor = Math.floor;
|
|
69
68
|
var max = Math.max;
|
|
@@ -1129,7 +1128,8 @@
|
|
|
1129
1128
|
var data = options.data || {};
|
|
1130
1129
|
|
|
1131
1130
|
// dedup query params
|
|
1132
|
-
var url =
|
|
1131
|
+
var url = options.url || this.url || "";
|
|
1132
|
+
if (_isFunction(url)) url = url.call(this);
|
|
1133
1133
|
var qsi = url.indexOf('?');
|
|
1134
1134
|
if (qsi != -1) {
|
|
1135
1135
|
_extend(data, queryStringToParams(url.slice(qsi + 1)));
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
(function (root, factory) {
|
|
2
|
+
if (typeof define === 'function' && define.amd) {
|
|
3
|
+
define(['backbone', 'underscore'], function (Backbone, _) {
|
|
4
|
+
Backbone.VirtualCollection = factory(root, Backbone, _);
|
|
5
|
+
root.VirtualCollection = Backbone.VirtualCollection;
|
|
6
|
+
});
|
|
7
|
+
} else if (typeof exports !== 'undefined') {
|
|
8
|
+
var Backbone = require('backbone');
|
|
9
|
+
var _ = require('underscore');
|
|
10
|
+
module.exports = factory(root, Backbone, _);
|
|
11
|
+
} else {
|
|
12
|
+
root.Backbone.VirtualCollection = factory(root, root.Backbone, root._);
|
|
13
|
+
root.VirtualCollection = root.Backbone.VirtualCollection;
|
|
14
|
+
}
|
|
15
|
+
}(this, function (root, Backbone, _) {
|
|
16
|
+
var VirtualCollection = Backbone.Collection.extend({
|
|
17
|
+
|
|
18
|
+
constructor: function (collection, options) {
|
|
19
|
+
options = options || {};
|
|
20
|
+
this.collection = collection;
|
|
21
|
+
|
|
22
|
+
if (options.comparator !== undefined) this.comparator = options.comparator;
|
|
23
|
+
if (options.close_with) this.bindLifecycle(options.close_with, 'close'); // Marionette 1.*
|
|
24
|
+
if (options.destroy_with) this.bindLifecycle(options.destroy_with, 'destroy'); // Marionette 2.*
|
|
25
|
+
if (!this.model) this.model = collection.model;
|
|
26
|
+
|
|
27
|
+
this.accepts = VirtualCollection.buildFilter(options.filter);
|
|
28
|
+
this._rebuildIndex();
|
|
29
|
+
this.listenTo(this.collection, 'add', this._onAdd);
|
|
30
|
+
this.listenTo(this.collection, 'remove', this._onRemove);
|
|
31
|
+
this.listenTo(this.collection, 'change', this._onChange);
|
|
32
|
+
this.listenTo(this.collection, 'reset', this._onReset);
|
|
33
|
+
this.listenTo(this.collection, 'sort', this._onSort);
|
|
34
|
+
|
|
35
|
+
this.initialize.apply(this, arguments);
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
// Marionette 1.*
|
|
39
|
+
bindLifecycle: function (view, method_name) {
|
|
40
|
+
view.on(method_name, _.bind(this.stopListening, this));
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
updateFilter: function (filter) {
|
|
44
|
+
this.accepts = VirtualCollection.buildFilter(filter);
|
|
45
|
+
this._rebuildIndex();
|
|
46
|
+
this.trigger('filter', this, filter);
|
|
47
|
+
this.trigger('reset', this, filter);
|
|
48
|
+
return this;
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
_rebuildIndex: function () {
|
|
52
|
+
this._reset();
|
|
53
|
+
this.collection.each(function (model, i) {
|
|
54
|
+
if (this.accepts(model, i)) {
|
|
55
|
+
this.models.push(model);
|
|
56
|
+
this._byId[model.cid] = model;
|
|
57
|
+
if (model.id) this._byId[model.id] = model;
|
|
58
|
+
}
|
|
59
|
+
}, this);
|
|
60
|
+
this.length = this.models.length;
|
|
61
|
+
|
|
62
|
+
if (this.comparator) this.sort({silent: true});
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
orderViaParent: function (options) {
|
|
66
|
+
this.models = this.collection.filter(function (model) {
|
|
67
|
+
return (this._byId[model.cid] !== undefined);
|
|
68
|
+
}, this);
|
|
69
|
+
if (!options.silent) this.trigger('sort', this, options);
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
_onSort: function (collection, options) {
|
|
73
|
+
if (this.comparator !== undefined) return;
|
|
74
|
+
this.orderViaParent(options);
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
_onAdd: function (model, collection, options) {
|
|
78
|
+
if (this.accepts(model, options.index)) {
|
|
79
|
+
this._indexAdd(model);
|
|
80
|
+
this.trigger('add', model, this, options);
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
_onRemove: function (model, collection, options) {
|
|
85
|
+
if (!this.get(model)) return;
|
|
86
|
+
|
|
87
|
+
var i = this._indexRemove(model)
|
|
88
|
+
, options_clone = _.clone(options);
|
|
89
|
+
options_clone.index = i;
|
|
90
|
+
|
|
91
|
+
this.trigger('remove', model, this, options_clone);
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
_onChange: function (model, options) {
|
|
95
|
+
var already_here = this.get(model);
|
|
96
|
+
|
|
97
|
+
if (this.accepts(model, options.index)) {
|
|
98
|
+
if (already_here) {
|
|
99
|
+
this.trigger('change', model, this, options);
|
|
100
|
+
} else {
|
|
101
|
+
this._indexAdd(model);
|
|
102
|
+
this.trigger('add', model, this, options);
|
|
103
|
+
}
|
|
104
|
+
} else {
|
|
105
|
+
if (already_here) {
|
|
106
|
+
var i = this._indexRemove(model)
|
|
107
|
+
, options_clone = _.clone(options);
|
|
108
|
+
options_clone.index = i;
|
|
109
|
+
this.trigger('remove', model, this, options_clone);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
|
|
114
|
+
_onReset: function (collection, options) {
|
|
115
|
+
this._rebuildIndex();
|
|
116
|
+
this.trigger('reset', this, options);
|
|
117
|
+
},
|
|
118
|
+
|
|
119
|
+
sortedIndex: function (model, value, context) {
|
|
120
|
+
var iterator = _.isFunction(value) ? value : function(target) {
|
|
121
|
+
return target.get(value);
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
if (iterator.length == 1) {
|
|
125
|
+
return _.sortedIndex(this.models, model, iterator, context);
|
|
126
|
+
} else {
|
|
127
|
+
return sortedIndexTwo(this.models, model, iterator, context);
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
|
|
131
|
+
_indexAdd: function (model) {
|
|
132
|
+
if (this.get(model)) return;
|
|
133
|
+
var i;
|
|
134
|
+
// uses a binsearch to find the right index
|
|
135
|
+
if (this.comparator) {
|
|
136
|
+
i = this.sortedIndex(model, this.comparator, this);
|
|
137
|
+
} else if (this.comparator === undefined) {
|
|
138
|
+
i = this.sortedIndex(model, function (target) {
|
|
139
|
+
//TODO: indexOf traverses the array every time the iterator is called
|
|
140
|
+
return this.collection.indexOf(target);
|
|
141
|
+
}, this);
|
|
142
|
+
} else {
|
|
143
|
+
i = this.length;
|
|
144
|
+
}
|
|
145
|
+
this.models.splice(i, 0, model);
|
|
146
|
+
this._byId[model.cid] = model;
|
|
147
|
+
if (model.id) this._byId[model.id] = model;
|
|
148
|
+
this.length += 1;
|
|
149
|
+
},
|
|
150
|
+
|
|
151
|
+
_indexRemove: function (model) {
|
|
152
|
+
var i = this.indexOf(model);
|
|
153
|
+
if (i === -1) return i;
|
|
154
|
+
this.models.splice(i, 1);
|
|
155
|
+
delete this._byId[model.cid];
|
|
156
|
+
if (model.id) delete this._byId[model.id];
|
|
157
|
+
this.length -= 1;
|
|
158
|
+
return i;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
}, { // static props
|
|
162
|
+
|
|
163
|
+
buildFilter: function (options) {
|
|
164
|
+
if (!options) {
|
|
165
|
+
return function () {
|
|
166
|
+
return true;
|
|
167
|
+
};
|
|
168
|
+
} else if (_.isFunction(options)) {
|
|
169
|
+
return options;
|
|
170
|
+
} else if (options.constructor === Object) {
|
|
171
|
+
return function (model) {
|
|
172
|
+
return !Boolean(_(Object.keys(options)).detect(function (key) {
|
|
173
|
+
return model.get(key) !== options[key];
|
|
174
|
+
}));
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
// methods that alter data should proxy to the parent collection
|
|
181
|
+
_.each(['add', 'remove', 'set', 'reset', 'push', 'pop', 'unshift', 'shift', 'slice', 'sync', 'fetch'], function (method_name) {
|
|
182
|
+
VirtualCollection.prototype[method_name] = function () {
|
|
183
|
+
return this.collection[method_name].apply(this.collection, _.toArray(arguments));
|
|
184
|
+
};
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
|
|
189
|
+
Equivalent to _.sortedIndex, but for comparators with two arguments
|
|
190
|
+
|
|
191
|
+
**/
|
|
192
|
+
function sortedIndexTwo (array, obj, iterator, context) {
|
|
193
|
+
var low = 0, high = array.length;
|
|
194
|
+
while (low < high) {
|
|
195
|
+
var mid = (low + high) >>> 1;
|
|
196
|
+
iterator.call(context, obj, array[mid]) > 0 ? low = mid + 1 : high = mid;
|
|
197
|
+
}
|
|
198
|
+
return low;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
_.extend(VirtualCollection.prototype, Backbone.Events);
|
|
202
|
+
|
|
203
|
+
return VirtualCollection;
|
|
204
|
+
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
//= require js_stack/plugins/backbone/paginator/2.0.
|
|
1
|
+
//= require js_stack/plugins/backbone/paginator/2.0.2
|
|
@@ -1 +1 @@
|
|
|
1
|
-
//= require js_stack/plugins/backbone/virtualcollection/0.
|
|
1
|
+
//= require js_stack/plugins/backbone/virtualcollection/0.5.0
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: js_stack
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tomasz Pewiński
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2014-07-
|
|
12
|
+
date: 2014-07-23 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: haml_coffee_assets
|
|
@@ -113,7 +113,7 @@ files:
|
|
|
113
113
|
- vendor/assets/javascripts/js_stack/base/marionette/1.6.4.js
|
|
114
114
|
- vendor/assets/javascripts/js_stack/base/marionette/1.7.4.js
|
|
115
115
|
- vendor/assets/javascripts/js_stack/base/marionette/1.8.8.js
|
|
116
|
-
- vendor/assets/javascripts/js_stack/base/marionette/2.0.
|
|
116
|
+
- vendor/assets/javascripts/js_stack/base/marionette/2.0.3.js
|
|
117
117
|
- vendor/assets/javascripts/js_stack/base/underscore.js
|
|
118
118
|
- vendor/assets/javascripts/js_stack/base/underscore/1.5.2.js
|
|
119
119
|
- vendor/assets/javascripts/js_stack/base/underscore/1.6.0.js
|
|
@@ -133,7 +133,7 @@ files:
|
|
|
133
133
|
- vendor/assets/javascripts/js_stack/plugins/backbone/mutators/0.4.2.js
|
|
134
134
|
- vendor/assets/javascripts/js_stack/plugins/backbone/pageable/1.3.2.js
|
|
135
135
|
- vendor/assets/javascripts/js_stack/plugins/backbone/pageable/1.4.8.js
|
|
136
|
-
- vendor/assets/javascripts/js_stack/plugins/backbone/paginator/2.0.
|
|
136
|
+
- vendor/assets/javascripts/js_stack/plugins/backbone/paginator/2.0.2.js
|
|
137
137
|
- vendor/assets/javascripts/js_stack/plugins/backbone/routefilter/0.2.1.js
|
|
138
138
|
- vendor/assets/javascripts/js_stack/plugins/backbone/stickit/0.6.3.js
|
|
139
139
|
- vendor/assets/javascripts/js_stack/plugins/backbone/stickit/0.7.0.js
|
|
@@ -141,6 +141,7 @@ files:
|
|
|
141
141
|
- vendor/assets/javascripts/js_stack/plugins/backbone/validation/0.8.1.js
|
|
142
142
|
- vendor/assets/javascripts/js_stack/plugins/backbone/validation/0.9.1.js
|
|
143
143
|
- vendor/assets/javascripts/js_stack/plugins/backbone/virtualcollection/0.4.15.js
|
|
144
|
+
- vendor/assets/javascripts/js_stack/plugins/backbone/virtualcollection/0.5.0.js
|
|
144
145
|
- vendor/assets/javascripts/js_stack/plugins/cocktail.js
|
|
145
146
|
- vendor/assets/javascripts/js_stack/plugins/cocktail/0.5.8.js
|
|
146
147
|
- vendor/assets/javascripts/js_stack/plugins/moment.js
|