devices view/models created
This commit is contained in:
parent
4e26793524
commit
60d5fc8323
|
@ -24,6 +24,8 @@ $(document).ready(function() {
|
||||||
|
|
||||||
window.rooms = new Rooms();
|
window.rooms = new Rooms();
|
||||||
window.roomsView = new RoomsView({collection: rooms});
|
window.roomsView = new RoomsView({collection: rooms});
|
||||||
|
window.devices = new Devices();
|
||||||
|
window.devicesView = new DevicesView({collection: devices});
|
||||||
|
|
||||||
window.App = new Workspace();
|
window.App = new Workspace();
|
||||||
Backbone.history.start()
|
Backbone.history.start()
|
||||||
|
|
|
@ -4,4 +4,9 @@
|
||||||
model: Room,
|
model: Room,
|
||||||
url: '/resources/json/rooms.json'
|
url: '/resources/json/rooms.json'
|
||||||
});
|
});
|
||||||
|
window.Device = Backbone.Model.extend({});
|
||||||
|
window.Devices = Backbone.Collection.extend({
|
||||||
|
model: Device,
|
||||||
|
url: '/control/devices'
|
||||||
|
});
|
||||||
})(jQuery);
|
})(jQuery);
|
|
@ -12,3 +12,11 @@ window.RoomsView = Backbone.View.extend({
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
window.DevicesView = Backbone.View.extend({
|
||||||
|
initialize: function() {
|
||||||
|
this.collection.bind('reset', this.render, this);
|
||||||
|
},
|
||||||
|
render: function() {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in New Issue