diff --git a/webgoat-container/src/main/webapp/js/goatApp/controller/LessonController.js b/webgoat-container/src/main/webapp/js/goatApp/controller/LessonController.js index 68f540263..3ac5e074e 100644 --- a/webgoat-container/src/main/webapp/js/goatApp/controller/LessonController.js +++ b/webgoat-container/src/main/webapp/js/goatApp/controller/LessonController.js @@ -85,7 +85,7 @@ define(['jquery', paramModel.set('stageParam',this.lessonContent.get('stageParam')); this.paramView = new ParamView({model:paramModel}); - this.hideShowHelps(null); + $('.lesson-help').hide(); this.trigger('menu:reload'); }; @@ -122,19 +122,26 @@ define(['jquery', if (!showId) { return; } - switch(showHelp) { - case 'plan': - $(contentId).html(this.planView.model.get('content')); - break; - case 'solution': - $(showId).html(this.solutionView.model.get('content')); - break; - case 'source': - $(contentId).html('
' + this.sourceView.model.get('content') + '
'); - break; + + if ($(showId).is(':visible')) { + $(showId).hide(); + return; + } else { + //TODO: move individual .html operations into individual help views + switch(showHelp) { + case 'plan': + $(contentId).html(this.planView.model.get('content')); + break; + case 'solution': + $(showId).html(this.solutionView.model.get('content')); + break; + case 'source': + $(contentId).html('
' + this.sourceView.model.get('content') + '
'); + break; + } + $(showId).show(); + GoatUtils.scrollToHelp() } - $(showId).show(); - GoatUtils.scrollToHelp() }; this.onShowHints = function() { diff --git a/webgoat-container/src/main/webapp/js/goatApp/view/HelpControlsView.js b/webgoat-container/src/main/webapp/js/goatApp/view/HelpControlsView.js index 2c331e728..905ddbaa8 100644 --- a/webgoat-container/src/main/webapp/js/goatApp/view/HelpControlsView.js +++ b/webgoat-container/src/main/webapp/js/goatApp/view/HelpControlsView.js @@ -6,9 +6,9 @@ function($,_,Backbone) { el:'#help-controls', //Check this helpButtons: { //TODO: move this into a template - showSource:$('