additional support for scoreboard view

This commit is contained in:
Jason White
2017-05-02 22:24:03 -04:00
parent 4a2701c79b
commit b840b0f3b5
2 changed files with 28 additions and 3 deletions

View File

@ -1,25 +1,34 @@
define(['jquery',
'underscore',
'backbone',
'goatApp/model/FlagsCollection'],
'goatApp/model/FlagsCollection',
'text!templates/scoreboard.html'],
function($,
_,
Backbone,
FlagsCollection) {
FlagsCollection,
ScoreboardTemplate) {
return Backbone.View.extend({
el:'#scoreboard',
initialize: function() {
template:ScoreboardTemplate,
this.collection = new FlagsCollection();
this.listenTo(this.collection,'reset',this.render)
this.collection.fetch({reset:true});
},
render: function() {
this.$el.html('test')
//this.$el.html('test');
var t = _.template(this.template);
this.$el.html(t({'flags':this.collection.toJSON()}));
//TODO: add template (table) to iterate over ...
//this.collection.toJSON(); << put that in the template data
//TODO: set up next poll here with listenToOnce
},
pollData: function() {
this.collection.fetch({reset:true});
}
});
});