diff --git a/webgoat-container/src/main/resources/static/js/goatApp/templates/scoreboard.html b/webgoat-container/src/main/resources/static/js/goatApp/templates/scoreboard.html new file mode 100644 index 000000000..141c3f5af --- /dev/null +++ b/webgoat-container/src/main/resources/static/js/goatApp/templates/scoreboard.html @@ -0,0 +1,16 @@ +
+ + + +
\ No newline at end of file diff --git a/webgoat-container/src/main/resources/static/js/goatApp/view/ScoreboardView.js b/webgoat-container/src/main/resources/static/js/goatApp/view/ScoreboardView.js index f7f607a8e..09ed711f4 100644 --- a/webgoat-container/src/main/resources/static/js/goatApp/view/ScoreboardView.js +++ b/webgoat-container/src/main/resources/static/js/goatApp/view/ScoreboardView.js @@ -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}); } }); }); \ No newline at end of file