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

@ -0,0 +1,16 @@
<div>
<div class="page-nav-wrapper"><span class="glyphicon-class glyphicon glyphicon-circle-arrow-left show-prev-page"></span></div>
<div class="page-link-wrapper">
<% var baseUrl = overview.baseUrl; %>
<% _.each(overview.pages, function(page,index) { %>
<a href="<%=overview.baseUrl%>/<%=index%>" alt="Page <%=index++ %>">
<% if (page.content === 'assignment') { %>
<div class="<%=page.pageClass%> <%=page.solvedClass%> <%=page.curPageClass%>"><%=index++%></div>
<% } else { %>
<div class="<%=page.pageClass%> <%=page.curPageClass%>"><%=index++%></div>
<% } %>
</a>
<% }); %>
</div>
<div class="page-nav-wrapper"><span class="glyphicon-class glyphicon glyphicon-circle-arrow-right show-next-page"></span></div>
</div>

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});
}
});
});