additional support for scoreboard view
This commit is contained in:
parent
4a2701c79b
commit
b840b0f3b5
@ -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>
|
@ -1,25 +1,34 @@
|
|||||||
define(['jquery',
|
define(['jquery',
|
||||||
'underscore',
|
'underscore',
|
||||||
'backbone',
|
'backbone',
|
||||||
'goatApp/model/FlagsCollection'],
|
'goatApp/model/FlagsCollection',
|
||||||
|
'text!templates/scoreboard.html'],
|
||||||
function($,
|
function($,
|
||||||
_,
|
_,
|
||||||
Backbone,
|
Backbone,
|
||||||
FlagsCollection) {
|
FlagsCollection,
|
||||||
|
ScoreboardTemplate) {
|
||||||
return Backbone.View.extend({
|
return Backbone.View.extend({
|
||||||
el:'#scoreboard',
|
el:'#scoreboard',
|
||||||
|
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
|
template:ScoreboardTemplate,
|
||||||
this.collection = new FlagsCollection();
|
this.collection = new FlagsCollection();
|
||||||
this.listenTo(this.collection,'reset',this.render)
|
this.listenTo(this.collection,'reset',this.render)
|
||||||
this.collection.fetch({reset:true});
|
this.collection.fetch({reset:true});
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function() {
|
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 ...
|
//TODO: add template (table) to iterate over ...
|
||||||
//this.collection.toJSON(); << put that in the template data
|
//this.collection.toJSON(); << put that in the template data
|
||||||
//TODO: set up next poll here with listenToOnce
|
//TODO: set up next poll here with listenToOnce
|
||||||
|
},
|
||||||
|
|
||||||
|
pollData: function() {
|
||||||
|
this.collection.fetch({reset:true});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
Loading…
x
Reference in New Issue
Block a user