scoreboard v 0.1 we'll say
This commit is contained in:
@ -1,4 +1,15 @@
|
||||
<table>
|
||||
<! -- iterate for header rows -->
|
||||
<!--
|
||||
<div class="scoreboard-title">WebGoat Challenge</div>
|
||||
<table class="scoreboard-table">
|
||||
<% _.each(rankings, function(userRanking) { %>
|
||||
<tr>
|
||||
<th class="username"> <div class="scoreboard-username"><%= userRanking.username %> </div></th>
|
||||
<td class="user-flags"> <% _.each(userRanking.flagsCaptured, function(flag) { %>
|
||||
|
||||
<div class="captured-flag">
|
||||
<i class="fa fa-flag" aria-hidden="true"></i>
|
||||
<%=flag%> </div>
|
||||
<% }); %>
|
||||
</td>
|
||||
</tr>
|
||||
<% }); %>
|
||||
</table>
|
@ -12,16 +12,16 @@ function($,
|
||||
el:'#scoreboard',
|
||||
|
||||
initialize: function() {
|
||||
template:ScoreboardTemplate,
|
||||
this.collection = new FlagsCollection();
|
||||
this.listenTo(this.collection,'reset',this.render)
|
||||
this.collection.fetch({reset:true});
|
||||
this.template = ScoreboardTemplate,
|
||||
this.collection = new FlagsCollection();
|
||||
this.listenTo(this.collection,'reset',this.render)
|
||||
this.collection.fetch({reset:true});
|
||||
},
|
||||
|
||||
render: function() {
|
||||
//this.$el.html('test');
|
||||
var t = _.template(this.template);
|
||||
this.$el.html(t({'flags':this.collection.toJSON()}));
|
||||
this.$el.html(t({'rankings':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
|
||||
|
Reference in New Issue
Block a user