Skip to content

Commit

Permalink
WebGoat#45 finally won't see two 'Stored XSS lessons hightlighted
Browse files Browse the repository at this point in the history
  • Loading branch information
misfir3 committed Dec 2, 2015
1 parent 0628a27 commit 539985c
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions webgoat-container/src/main/webapp/js/goatApp/view/MenuView.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ define(['jquery',

catLink.append(catArrow);
catLink.append(catLinkText);
//TODO: refactor this along with sub-views/components
var self = this;
catLink.click(_.bind(this.expandCategory,this,catId));
category.append(catLink);
Expand All @@ -62,12 +61,12 @@ define(['jquery',
for (var j=0; j < lessons.length;j++) {
var lessonItem = $('<li>',{class:'lesson'});
var lessonName = lessons[j].name;
var lessonId = GoatUtils.makeId(lessonName);
var lessonId = catId + '-' + GoatUtils.makeId(lessonName);
if (this.curLessonLinkId === lessonId) {
lessonItem.addClass('selected');
}
var lessonLink = $('<a>',{href:lessons[j].link,text:lessonName,id:lessonId});
lessonLink.click(_.bind(this.onLessonClick,this,lessonName));
lessonLink.click(_.bind(this.onLessonClick,this,lessonId));
lessonItem.append(lessonLink);
//check for lab/stages
categoryLessonList.append(lessonItem);
Expand All @@ -78,12 +77,12 @@ define(['jquery',
for (k=0; k < stages.length; k++) {
var stageItem = $('<li>',{class:'stage'});
var stageName = stages[k].name;
var stageId = GoatUtils.makeId(stageName);
var stageId = lessonId + '-stage' + k;
if (this.curLessonLinkId === stageId) {
stageItem.addClass('selected');
}
var stageLink = $('<a>',{href:stages[k].link,text:stageName,id:stageId});
stageLink.click(_.bind(this.onLessonClick,this,stageName));
stageLink.click(_.bind(this.onLessonClick,this,stageId));
stageItem.append(stageLink);
categoryLessonList.append(stageItem);
if (stages[k].complete) {
Expand All @@ -108,14 +107,11 @@ define(['jquery',
this.collection.fetch();
},

onLessonClick: function (title) {
var oldLinkId = GoatUtils.makeId(this.curLessonLinkId);
$('#'+oldLinkId).removeClass('selected');
onLessonClick: function (elementId) {
$('#'+this.curLessonLinkId).removeClass('selected');
//update
this.curLessonLinkId = GoatUtils.makeId(title);
var newLinkId = GoatUtils.makeId(this.curLessonLinkId)
$('#'+newLinkId).addClass('selected');
this.trigger('lesson:click', title); // will cause menu reload
$('#'+elementId).addClass('selected');
this.curLessonLinkId = elementId;
},

expandCategory: function (id) {
Expand Down

0 comments on commit 539985c

Please sign in to comment.