lib/assets/javascripts/transistor-backbone.js in transistor-0.1.10 vs lib/assets/javascripts/transistor-backbone.js in transistor-0.1.11
- old
+ new
@@ -20,19 +20,21 @@
return {
};
}());
backbone_collection = new Backbone.Collection();
- backbone_collection.on('change', function (model) {
+ backbone_collection.on('change', function (model, options) {
var entry = U.clone(model.attributes),
id = model.id;
- if (!control) {
- throw "BackboneCollection is not mutable by user. The model with id "+model.id+" has been changed";
- } else {
- delete entry.id;
- control.update(channel, id, entry);
+ if (options.from_radiotower === undefined) {
+ if (!control) {
+ throw "BackboneCollection is not mutable by user. The model with id "+model.id+" has been changed";
+ } else {
+ delete entry.id;
+ control.update(channel, id, entry);
+ }
}
});
collection_interface = {
add: backbone_collection.add,
@@ -97,10 +99,10 @@
},
update: function (id, entry) {
collection_interface.asPublic(function () {
var model = backbone_collection.get(id);
model.clear({silent: true});
- model.set(entry, {silent: true});
+ model.set(entry, {from_radiotower: true});
});
},
remove: function (id) {
collection_interface.asPublic(function () {
var model = backbone_collection.get(id);