initial plumb of scoreboard
This commit is contained in:
@ -8,7 +8,6 @@ define(['jquery',
|
||||
'goatApp/view/SolutionView',
|
||||
'goatApp/view/HintView',
|
||||
'goatApp/view/HelpControlsView',
|
||||
'goatApp/view/CookieView',
|
||||
'goatApp/view/ParamView',
|
||||
'goatApp/model/ParamModel',
|
||||
'goatApp/view/DeveloperControlsView',
|
||||
@ -32,7 +31,6 @@ define(['jquery',
|
||||
SolutionView,
|
||||
HintView,
|
||||
HelpControlsView,
|
||||
CookieView,
|
||||
ParamView,
|
||||
ParamModel,
|
||||
DeveloperControlsView,
|
||||
@ -130,7 +128,6 @@ define(['jquery',
|
||||
this.solutionView = new SolutionView();
|
||||
this.sourceView = new SourceView();
|
||||
this.lessonHintView = new HintView();
|
||||
this.cookieView = new CookieView();
|
||||
|
||||
//TODO: instantiate model with values (not sure why was not working before)
|
||||
var paramModel = new ParamModel({});
|
||||
|
@ -1,13 +1,13 @@
|
||||
define(['jquery',
|
||||
'underscore',
|
||||
'backbone',
|
||||
'goatApp/model/CookieModel'],
|
||||
'goatApp/model/FlagModel'],
|
||||
function($,
|
||||
_,
|
||||
Backbone,
|
||||
CookieModel) {
|
||||
FlagModel) {
|
||||
return Backbone.Collection.extend({
|
||||
url:'service/cookie.mvc',
|
||||
model:CookieModel
|
||||
url:'/WebGoat/scoreboard-data',
|
||||
model:FlagModel
|
||||
});
|
||||
});
|
@ -0,0 +1,17 @@
|
||||
define(['jquery',
|
||||
'underscore',
|
||||
'backbone',
|
||||
'goatApp/support/goatAsyncErrorHandler',
|
||||
'goatApp/view/ScoreboardView'],
|
||||
function ($,
|
||||
_,
|
||||
Backbone,
|
||||
asyncErrorHandler,
|
||||
ScoreboardView) {
|
||||
'use strict'
|
||||
return {
|
||||
initApp: function () {
|
||||
scoreboard = new ScoreboardView();
|
||||
}
|
||||
};
|
||||
});
|
@ -1,34 +0,0 @@
|
||||
define(['jquery',
|
||||
'underscore',
|
||||
'backbone',
|
||||
'goatApp/model/CookieCollection'],
|
||||
function($,
|
||||
_,
|
||||
Backbone,
|
||||
CookieCollection) {
|
||||
return Backbone.View.extend({
|
||||
el:'#cookies-view',
|
||||
|
||||
initialize: function() {
|
||||
this.collection = new CookieCollection();
|
||||
this.listenTo(this.collection,'reset',this.render)
|
||||
this.collection.fetch({reset:true});
|
||||
},
|
||||
|
||||
render: function() {
|
||||
this.$el.html('')
|
||||
var cookieTable;
|
||||
this.collection.each(function(model) {
|
||||
cookieTable = $('<table>',{'class':'cookie-table table-striped table-nonfluid'});
|
||||
_.each(model.keys(), function(attribute) {
|
||||
var newRow = $('<tr>');
|
||||
newRow.append($('<th>',{text:_.escape(attribute)}))
|
||||
newRow.append($('<td>',{text:_.escape(model.get(attribute))}));
|
||||
cookieTable.append(newRow);
|
||||
});
|
||||
});
|
||||
this.$el.append($('<h4>',{text:'Cookie/s'}));
|
||||
this.$el.append(cookieTable);
|
||||
}
|
||||
});
|
||||
});
|
@ -0,0 +1,25 @@
|
||||
define(['jquery',
|
||||
'underscore',
|
||||
'backbone',
|
||||
'goatApp/model/FlagsCollection'],
|
||||
function($,
|
||||
_,
|
||||
Backbone,
|
||||
FlagsCollection) {
|
||||
return Backbone.View.extend({
|
||||
el:'#scoreboard',
|
||||
|
||||
initialize: function() {
|
||||
this.collection = new FlagsCollection();
|
||||
this.listenTo(this.collection,'reset',this.render)
|
||||
this.collection.fetch({reset:true});
|
||||
},
|
||||
|
||||
render: function() {
|
||||
this.$el.html('test')
|
||||
//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