Skip to content

Commit

Permalink
Merge pull request WebGoat#202 from misfir3/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
mayhew64 committed Feb 23, 2016
2 parents daa05dd + 575c940 commit 3d7eb40
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
5 changes: 5 additions & 0 deletions webgoat-container/src/main/webapp/WEB-INF/pages/main_new.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@
<div class="col-md-8">
<div class="col-md-12" align="left">
<div class="panel" id="help-controls">
<button class="btn btn-primary btn-xs help-button" id="show-source-button">Show Source</button>
<button class="btn btn-primary btn-xs help-button" id="show-solution-button">Show Solution</button>
<button class="btn btn-primary btn-xs help-button" id="show-plan-button">Show Plan</button>
<button class="btn btn-primary btn-xs help-button" id="show-hints-button">Show Hints</button>
<button class="btn btn-xs help-button" id="show-hints-button">Restart Lesson</button>
</div>
<div class="lesson-hint" id="lesson-hint-container">
<h4>Hints</h4>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,7 @@ define(['jquery',
function($,_,Backbone) {
return Backbone.View.extend({
el:'#help-controls', //Check this
helpButtons: {
//TODO: move this into a template
showSource:$('<button>',{id:'show-source-button','class':'btn btn-primary btn-xs help-button',type:'button',text:'Java Source'}),
showSolution:$('<button>',{id:'show-solution-button','class':'btn btn-primary btn-xs help-button',type:'button',text:'Solution'}),
showPlan:$('<button>',{id:'show-plan-button','class':'btn btn-primary btn-xs help-button',type:'button',text:'Lesson Plan'}),
showHints:$('<button>',{id:'show-hints-button','class':'btn btn-primary btn-xs help-button',type:'button',text:'Hints'}),
restartLesson:$('<button>',{id:'restart-lesson-button','class':'btn btn-xs help-button',type:'button',text:'Restart Lesson'})
},

initialize: function (options) {
if (!options) {
return;
Expand All @@ -21,28 +14,30 @@ function($,_,Backbone) {
this.hasSource = options.hasSource;
this.hasHints = options.hasHints;
},

render:function(title) {
this.$el.html();

//this.$el.html();
// if still showing, hide
$('#show-source-button').hide();
$('#show-solution-button').hide();
$('#show-plan-button').hide();
$('#show-hints-button').hide();

if (this.hasSource) {
this.helpButtons.showSource.unbind().on('click',_.bind(this.showSource,this));
this.$el.append(this.helpButtons.showSource);
this.$el.find('#show-source-button').unbind().on('click',_.bind(this.showSource,this)).show();
}
if (this.hasSolution) {
this.helpButtons.showSolution.unbind().on('click',_.bind(this.showSolution,this));
this.$el.append(this.helpButtons.showSolution);
this.$el.find('#show-solution-button').unbind().on('click',_.bind(this.showSolution,this)).show();
}
if (this.hasPlan) {
this.helpButtons.showPlan.unbind().on('click',_.bind(this.showPlan,this));
this.$el.append(this.helpButtons.showPlan);
this.$el.find('#show-plan-button').unbind().on('click',_.bind(this.showPlan,this)).show();
}
if (this.hasHints) {
this.helpButtons.showHints.unbind().on('click',_.bind(this.showHints,this));
this.$el.append(this.helpButtons.showHints);
this.$el.find('#show-hints-button').unbind().on('click',_.bind(this.showHints,this)).show();
}

this.helpButtons.restartLesson.unbind().on('click',_.bind(this.restartLesson,this));
this.$el.append(this.helpButtons.restartLesson);
this.$el.find('#restart-lesson-button').unbind().on('click',_.bind(this.restartLesson,this)).show();
//this.$el.append(this.helpButtons.restartLesson);
},

showSource: function() {
Expand Down

0 comments on commit 3d7eb40

Please sign in to comment.