class Event extends Backbone.Model
class Events extends Backbone.Collection
model: Event
class EventsView extends Backbone.View
initialize: -> @collection.on "sync add", @render, @
render: ->
results = []
if @collection.isEmpty()
@$el.html "Empty Collection"
else
results = @collection.map (model) -> "#{model.get('id')} --- #{model.get('text')}"
@$el.html results.join("<br />")
events = new Events([{id:1, text: "Google"}, {id:2, text: "Yahoo"}])
view = new EventsView collection: events, el: "body"
view.render()
events.add({id:6, text: "HuffingtonPost"})
Семидюймовый планшет вполне можно разместить — а 15-дюймовую махину, вряд ли.