js_stack 0.5.7 → 0.6.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/README.md +7 -7
- data/lib/js_stack/version.rb +1 -1
- data/vendor/assets/javascripts/js_stack/base/marionette/{1.8.0.js → 1.8.3.js} +173 -8
- data/vendor/assets/javascripts/js_stack/base/marionette.js +1 -1
- data/vendor/assets/javascripts/js_stack/plugins/backbone/stickit/0.8.0.js +595 -0
- data/vendor/assets/javascripts/js_stack/plugins/backbone.stickit.js +1 -1
- metadata +4 -17
- data/vendor/assets/javascripts/js_stack/base/backbone/1.1.0.js +0 -1581
- data/vendor/assets/javascripts/js_stack/base/backbone/1.1.1.js +0 -1609
- data/vendor/assets/javascripts/js_stack/base/marionette/1.6.2.js +0 -2555
- data/vendor/assets/javascripts/js_stack/base/marionette/1.7.0.js +0 -2746
- data/vendor/assets/javascripts/js_stack/base/marionette/1.7.3.js +0 -2765
- data/vendor/assets/javascripts/js_stack/plugins/backbone/associations/0.5.1.js +0 -533
- data/vendor/assets/javascripts/js_stack/plugins/backbone/associations/0.5.4.js +0 -574
- data/vendor/assets/javascripts/js_stack/plugins/backbone/mutators/0.4.1.js +0 -207
- data/vendor/assets/javascripts/js_stack/plugins/backbone/pageable/1.4.5.js +0 -1318
- data/vendor/assets/javascripts/js_stack/plugins/backbone/virtualcollection/0.4.11.js +0 -345
- data/vendor/assets/javascripts/js_stack/plugins/backbone/virtualcollection/0.4.12.js +0 -351
- data/vendor/assets/javascripts/js_stack/plugins/backbone/virtualcollection/0.4.14.js +0 -398
- data/vendor/assets/javascripts/js_stack/plugins/backbone/virtualcollection/0.4.5.js +0 -293
- data/vendor/assets/javascripts/js_stack/plugins/backbone/virtualcollection/0.4.8.js +0 -340
@@ -1,207 +0,0 @@
|
|
1
|
-
/*! Backbone.Mutators - v0.4.1
|
2
|
-
------------------------------
|
3
|
-
Build @ 2013-12-01
|
4
|
-
Documentation and Full License Available at:
|
5
|
-
http://asciidisco.github.com/Backbone.Mutators/index.html
|
6
|
-
git://github.com/asciidisco/Backbone.Mutators.git
|
7
|
-
Copyright (c) 2013 Sebastian Golasch <public@asciidisco.com>
|
8
|
-
|
9
|
-
Permission is hereby granted, free of charge, to any person obtaining a
|
10
|
-
copy of this software and associated documentation files (the "Software"),
|
11
|
-
to deal in the Software without restriction, including without limitation
|
12
|
-
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
13
|
-
and/or sell copies of the Software, and to permit persons to whom the
|
14
|
-
|
15
|
-
Software is furnished to do so, subject to the following conditions:
|
16
|
-
The above copyright notice and this permission notice shall be included in
|
17
|
-
all copies or substantial portions of the Software.
|
18
|
-
|
19
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
20
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
21
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
22
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
23
|
-
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
24
|
-
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
25
|
-
IN THE SOFTWARE.*/
|
26
|
-
(function (root, factory, undef) {
|
27
|
-
'use strict';
|
28
|
-
|
29
|
-
if (typeof exports === 'object') {
|
30
|
-
// Node. Does not work with strict CommonJS, but
|
31
|
-
// only CommonJS-like enviroments that support module.exports,
|
32
|
-
// like Node.
|
33
|
-
module.exports = factory(require('underscore'), require('Backbone'));
|
34
|
-
} else if (typeof define === 'function' && define.amd) {
|
35
|
-
// AMD. Register as an anonymous module.
|
36
|
-
define(['underscore', 'backbone'], function (_, Backbone) {
|
37
|
-
// Check if we use the AMD branch of Back
|
38
|
-
_ = _ === undef ? root._ : _;
|
39
|
-
Backbone = Backbone === undef ? root.Backbone : Backbone;
|
40
|
-
return (root.returnExportsGlobal = factory(_, Backbone, root));
|
41
|
-
});
|
42
|
-
} else {
|
43
|
-
// Browser globals
|
44
|
-
root.returnExportsGlobal = factory(root._, root.Backbone);
|
45
|
-
}
|
46
|
-
|
47
|
-
// Usage:
|
48
|
-
//
|
49
|
-
// Note: This plugin is UMD compatible, you can use it in node, amd and vanilla js envs
|
50
|
-
//
|
51
|
-
// Vanilla JS:
|
52
|
-
// <script src="underscore.js"></script>
|
53
|
-
// <script src="backbone.js"></script>
|
54
|
-
// <script src="backbone.mutators.js"></script>
|
55
|
-
//
|
56
|
-
// Node:
|
57
|
-
// var _ = require('underscore');
|
58
|
-
// var Backbone = require('backbone');
|
59
|
-
// var Mutators = require('backbone.mutators');
|
60
|
-
//
|
61
|
-
//
|
62
|
-
// AMD:
|
63
|
-
// define(['underscore', 'backbone', 'backbone.mutators'], function (_, Backbone, Mutators) {
|
64
|
-
// // insert sample from below
|
65
|
-
// return User;
|
66
|
-
// });
|
67
|
-
//
|
68
|
-
// var User = Backbone.Model.extend({
|
69
|
-
// mutators: {
|
70
|
-
// fullname: function () {
|
71
|
-
// return this.firstname + ' ' + this.lastname;
|
72
|
-
// }
|
73
|
-
// },
|
74
|
-
//
|
75
|
-
// defaults: {
|
76
|
-
// firstname: 'Sebastian',
|
77
|
-
// lastname: 'Golasch'
|
78
|
-
// }
|
79
|
-
// });
|
80
|
-
//
|
81
|
-
// var user = new User();
|
82
|
-
// user.get('fullname') // returns 'Sebastian Golasch'
|
83
|
-
// user.toJSON() // return '{firstname: 'Sebastian', lastname: 'Golasch', fullname: 'Sebastian Golasch'}'
|
84
|
-
|
85
|
-
}(this, function (_, Backbone, root, undef) {
|
86
|
-
'use strict';
|
87
|
-
|
88
|
-
// check if we use the amd branch of backbone and underscore
|
89
|
-
Backbone = Backbone === undef ? root.Backbone : Backbone;
|
90
|
-
_ = _ === undef ? root._ : _;
|
91
|
-
|
92
|
-
// extend backbones model prototype with the mutator functionality
|
93
|
-
var Mutator = function () {},
|
94
|
-
oldGet = Backbone.Model.prototype.get,
|
95
|
-
oldSet = Backbone.Model.prototype.set,
|
96
|
-
oldToJson = Backbone.Model.prototype.toJSON;
|
97
|
-
|
98
|
-
// This is necessary to ensure that Models declared without the mutators object do not throw and error
|
99
|
-
Mutator.prototype.mutators = {};
|
100
|
-
|
101
|
-
// override get functionality to fetch the mutator props
|
102
|
-
Mutator.prototype.get = function (attr) {
|
103
|
-
var isMutator = this.mutators !== undef;
|
104
|
-
|
105
|
-
// check if we have a getter mutation
|
106
|
-
if (isMutator === true && _.isFunction(this.mutators[attr]) === true) {
|
107
|
-
return this.mutators[attr].call(this);
|
108
|
-
}
|
109
|
-
|
110
|
-
// check if we have a deeper nested getter mutation
|
111
|
-
if (isMutator === true && _.isObject(this.mutators[attr]) === true && _.isFunction(this.mutators[attr].get) === true) {
|
112
|
-
return this.mutators[attr].get.call(this);
|
113
|
-
}
|
114
|
-
|
115
|
-
return oldGet.call(this, attr);
|
116
|
-
};
|
117
|
-
|
118
|
-
// override set functionality to set the mutator props
|
119
|
-
Mutator.prototype.set = function (key, value, options) {
|
120
|
-
var isMutator = this.mutators !== undef,
|
121
|
-
ret = null,
|
122
|
-
attrs = null;
|
123
|
-
|
124
|
-
ret = oldSet.call(this, key, value, options);
|
125
|
-
|
126
|
-
// seamleassly stolen from backbone core
|
127
|
-
// check if the setter action is triggered
|
128
|
-
// using key <-> value or object
|
129
|
-
if (_.isObject(key) || key === null) {
|
130
|
-
attrs = key;
|
131
|
-
options = value;
|
132
|
-
} else {
|
133
|
-
attrs = {};
|
134
|
-
attrs[key] = value;
|
135
|
-
}
|
136
|
-
|
137
|
-
// check if we have a deeper nested setter mutation
|
138
|
-
if (isMutator === true && _.isObject(this.mutators[key]) === true) {
|
139
|
-
|
140
|
-
// check if we need to set a single value
|
141
|
-
if (_.isFunction(this.mutators[key].set) === true) {
|
142
|
-
ret = this.mutators[key].set.call(this, key, attrs[key], options, _.bind(oldSet, this));
|
143
|
-
} else if(_.isFunction(this.mutators[key])){
|
144
|
-
ret = this.mutators[key].call(this, key, attrs[key], options, _.bind(oldSet, this));
|
145
|
-
}
|
146
|
-
}
|
147
|
-
|
148
|
-
if (isMutator === true && _.isObject(attrs)) {
|
149
|
-
_.each(attrs, _.bind(function (attr, attrKey) {
|
150
|
-
if (_.isObject(this.mutators[attrKey]) === true) {
|
151
|
-
// check if we need to set a single value
|
152
|
-
|
153
|
-
var meth = this.mutators[attrKey];
|
154
|
-
if(_.isFunction(meth.set)){
|
155
|
-
meth = meth.set;
|
156
|
-
}
|
157
|
-
|
158
|
-
if(_.isFunction(meth)){
|
159
|
-
if (options === undef || (_.isObject(options) === true && options.silent !== true && (options.mutators !== undef && options.mutators.silent !== true))) {
|
160
|
-
this.trigger('mutators:set:' + attrKey);
|
161
|
-
}
|
162
|
-
meth.call(this, attrKey, attr, options, _.bind(oldSet, this));
|
163
|
-
}
|
164
|
-
|
165
|
-
}
|
166
|
-
}, this));
|
167
|
-
}
|
168
|
-
|
169
|
-
return ret;
|
170
|
-
};
|
171
|
-
|
172
|
-
// override toJSON functionality to serialize mutator properties
|
173
|
-
Mutator.prototype.toJSON = function (options) {
|
174
|
-
// fetch ye olde values
|
175
|
-
var attr = oldToJson.call(this),
|
176
|
-
isSaving,
|
177
|
-
isTransient;
|
178
|
-
// iterate over all mutators (if there are some)
|
179
|
-
_.each(this.mutators, _.bind(function (mutator, name) {
|
180
|
-
// check if we have some getter mutations
|
181
|
-
if (_.isObject(this.mutators[name]) === true && _.isFunction(this.mutators[name].get)) {
|
182
|
-
isSaving = _.has(options || {}, 'emulateHTTP');
|
183
|
-
isTransient = this.mutators[name].transient;
|
184
|
-
if (!isSaving || !isTransient) {
|
185
|
-
attr[name] = _.bind(this.mutators[name].get, this)();
|
186
|
-
}
|
187
|
-
} else {
|
188
|
-
attr[name] = _.bind(this.mutators[name], this)();
|
189
|
-
}
|
190
|
-
}, this));
|
191
|
-
|
192
|
-
return attr;
|
193
|
-
};
|
194
|
-
|
195
|
-
// override get functionality to get HTML-escaped the mutator props
|
196
|
-
Mutator.prototype.escape = function (attr){
|
197
|
-
var val = this.get(attr);
|
198
|
-
return _.escape(val == null ? '' : '' + val);
|
199
|
-
};
|
200
|
-
|
201
|
-
// extend the models prototype
|
202
|
-
_.extend(Backbone.Model.prototype, Mutator.prototype);
|
203
|
-
|
204
|
-
// make mutators globally available under the Backbone namespace
|
205
|
-
Backbone.Mutators = Mutator;
|
206
|
-
return Mutator;
|
207
|
-
}));
|