forked from WebGoat/WebGoat
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request WebGoat#298 from WebGoat/lesson_overview
WebGoat#276 Automatic lesson summary page
- Loading branch information
Showing
34 changed files
with
214 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,6 @@ | |
public class Assignment implements Serializable { | ||
|
||
private final String name; | ||
|
||
private final String path; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
webgoat-container/src/main/resources/static/js/goatApp/model/AssignmentModel.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
define([ | ||
'backbone'], | ||
function( | ||
Backbone) { | ||
return Backbone.Model.extend({ | ||
}); | ||
}); | ||
|
10 changes: 10 additions & 0 deletions
10
webgoat-container/src/main/resources/static/js/goatApp/model/LessonOverviewModel.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
define([ | ||
'backbone'], | ||
function( | ||
Backbone) { | ||
return Backbone.Collection.extend({ | ||
tagName: 'ul', | ||
url: 'service/lessonoverview.mvc' | ||
}); | ||
}); | ||
|
24 changes: 24 additions & 0 deletions
24
webgoat-container/src/main/resources/static/js/goatApp/view/AssignmentOverview.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
define([ | ||
'backbone'], | ||
function( | ||
Backbone) { | ||
return Backbone.View.extend({ | ||
tagName: 'li', | ||
template: _.template($('#assignmentTemplate').html() ), | ||
|
||
events: { | ||
"click a": "clicked" | ||
}, | ||
|
||
clicked: function(e){ | ||
e.preventDefault(); | ||
var id = $(e.currentTarget).data("id"); | ||
Backbone.trigger('assignment:navTo',{'assignment': id}); | ||
}, | ||
|
||
render: function() { | ||
this.$el.html(this.template(this.model.toJSON())); | ||
return this; | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
webgoat-container/src/main/resources/static/js/goatApp/view/LessonOverviewView.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
define(['jquery', | ||
'underscore', | ||
'backbone', | ||
'goatApp/model/LessonOverviewModel', | ||
'goatApp/view/AssignmentOverview'], | ||
function($, | ||
_, | ||
Backbone, | ||
LessonOverviewModel, | ||
AssignmentOverview) { | ||
return Backbone.View.extend({ | ||
el:'#lesson-overview', | ||
initialize: function (lessonOverviewModel) { | ||
this.model = lessonOverviewModel; | ||
this.listenTo(this.model, 'change add remove update', this.render); | ||
this.hideLessonOverview(); | ||
}, | ||
|
||
showAssignments: function() { | ||
this.$el.html(''); | ||
this.model.each(function(assignment) { | ||
var assignmentView = new AssignmentOverview({ model: assignment }); | ||
this.$el.append(assignmentView.render().el); | ||
}, this); | ||
}, | ||
|
||
render: function() { | ||
if (this.isVisible()) { | ||
this.$el.hide(); | ||
} else { | ||
this.$el.show(); | ||
} | ||
this.showAssignments(); | ||
|
||
return this; | ||
}, | ||
|
||
isVisible: function() { | ||
return this.$el.is(':visible'); | ||
}, | ||
|
||
hideLessonOverview: function() { | ||
if (this.$el.is(':visible')) { | ||
this.$el.hide(); | ||
} | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.