README
Backbone.ribs - Wiki
Backbone.ribs expands capabilities of Backbone.
Deep Get & Set
Ribs allow to get and set model attributes on any depth.
var model = new Backbone.Ribs.Model({
foo: {
bar: 'test'
}
});
model.get('foo.bar'); //"test"
model.set('foo.bar', 'newValue');
Computed attributes
With Ribs you can add computed model attributes.
var CompModel = Backbone.Ribs.Model.extend({
defaults: {
bar: 10,
foo: 20
},
computeds: {
fooBarComp: {
deps: ['bar', 'foo'],
get: function (bar, foo) {
return bar + '-' + foo;
}
}
}
});
var compModel = new CompModel();
compModel.set('bar', 30);
compModel.get('fooBarComp'); //30-20
Bindings
Bindings allow you to set a one-way or two-way binging between the models and the DOM elements.
Binding Collection
Binding collection is useful in cases when you need to create a view for a collection - tables, lists and other structures with multiple similar items.
During applying binding, for each model in the collection will be created its own instance of ItemView. The root element of the newly created view will be added inside the element, which selector was described in binding.
Change Log
v0.5.11 - 25.01.2016
- Bindings: bug fixes
v0.5.10 - 27.12.2015
- Computeds: bug fixes
v0.5.9 - 25.12.2015
- Bindings: some optimizations
- Computeds: bug fixes
v0.5.8 - 12.12.2015
- Bindings: bug fixes
- Bindings: using
Backbone.Modelfor bindings is deprecated (will be deleted in v1.0.0)
v0.5.7 - 11.12.2015
- Bindings: binding
toggleByClass- added!importantdeclarations - Bindings:
inDOMbinding bug fixes (will be deleted in v1.0.0)
v0.5.6 - 05.12.2015
- Bindings: new binding type -
toggleByClass - Bindings:
inDOMbinding bug fixes
v0.5.5 - 02.12.2015
- Computed attributes: fixed
model.clone()bug
v0.5.4 - 29.11.2015
- Computed attributes: returned computed attribute without
depsfor backward compatibility (will be deleted in v1.0.0) - Computed attributes: returned update computed attributes by triggering 'change' event
v0.5.3 - 04.11.2015
- Model: pass changed attribute's name into event's callback
v0.5.2 - 31.10.2015
- Computeds:
toJSONflag in declaration - Bindings: some optimizations
- Deep get/set: bug fix
v0.5.1 - 29.10.2015
- Bindings:
bindings,handlersandfilterscan be a function - Bindings: custom
eventsin customhandlers
v0.5.0 - 25.10.2015
- Compatibility with Backbone 1.2.3
- Computed attributes: computed attributes in
model.attributeshash (significant change) - Computed attributes: deprecate computed attribute without
deps(significant change) - Computed attributes: fixed problem with triggering excess
changeevents - Computed attributes: new method
isComputed - Bindings: binding callback
- Bindings: updated bindings earlier than other handlers
- Bindings:
inDOM- fixed many problems. And now you can use it ;) - Binding Collection: allow waterfall adding views to DOM
- Allow to get previous model's attributes on any depth by
deepPreviousflag (this slows down themodel.set, be careful)
v0.4.6 - 25.03.2015
- forwarding event object into
getbinding handler
v0.4.5 - 16.03.2015
inDOMbinding bug fixes
v0.4.4 - 11.03.2015
- passing
optionstosetbinding handler
v0.4.3 - 04.03.2015
setandgetinnotfilter
v0.4.2 - 03.12.2014
- bug fixes
v0.4.1 - 16.11.2014
- no more sorting collection in applying binding collection
- optimize rendering binding collection when adding new models to the collection
- new view method signature of
renderCollection
v0.4.0 - 14.11.2014
- new model method
addComputeds - new model method signature of
removeComputeds - model method
addComputedis redundant, useaddComputeds(will be deleted in v1.0.0) - bug fixes
v0.3.1 - 11.11.2014
- new binding type
inDOM - new view method
getEl - new view method
appendTo - new view method
addBindings - new view method signature of
updateBindings - new view method signature of
renderCollection(incompatible with v0.2.10) - new view method
getCollectionViews - view method
addBindingis redundant, useaddBindings(will be deleted in v1.0.0) - view method
applyCollectionis redundant, useaddBindings(will be deleted in v1.0.0) - bug fixes and optimisation