#180, better management of show* buttons
This commit is contained in:
parent
daa05dd192
commit
7c65441c8e
@ -102,6 +102,11 @@
|
|||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
<div class="col-md-12" align="left">
|
<div class="col-md-12" align="left">
|
||||||
<div class="panel" id="help-controls">
|
<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>
|
||||||
<div class="lesson-hint" id="lesson-hint-container">
|
<div class="lesson-hint" id="lesson-hint-container">
|
||||||
<h4>Hints</h4>
|
<h4>Hints</h4>
|
||||||
|
@ -4,14 +4,14 @@ define(['jquery',
|
|||||||
function($,_,Backbone) {
|
function($,_,Backbone) {
|
||||||
return Backbone.View.extend({
|
return Backbone.View.extend({
|
||||||
el:'#help-controls', //Check this
|
el:'#help-controls', //Check this
|
||||||
helpButtons: {
|
// helpButtons: {
|
||||||
//TODO: move this into a template
|
// //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'}),
|
// showSource:,
|
||||||
showSolution:$('<button>',{id:'show-solution-button','class':'btn btn-primary btn-xs help-button',type:'button',text:'Solution'}),
|
// showSolution:,
|
||||||
showPlan:$('<button>',{id:'show-plan-button','class':'btn btn-primary btn-xs help-button',type:'button',text:'Lesson Plan'}),
|
// showPlan:,
|
||||||
showHints:$('<button>',{id:'show-hints-button','class':'btn btn-primary btn-xs help-button',type:'button',text:'Hints'}),
|
// showHints:,
|
||||||
restartLesson:$('<button>',{id:'restart-lesson-button','class':'btn btn-xs help-button',type:'button',text:'Restart Lesson'})
|
// restartLesson:
|
||||||
},
|
// },
|
||||||
initialize: function (options) {
|
initialize: function (options) {
|
||||||
if (!options) {
|
if (!options) {
|
||||||
return;
|
return;
|
||||||
@ -22,27 +22,28 @@ function($,_,Backbone) {
|
|||||||
this.hasHints = options.hasHints;
|
this.hasHints = options.hasHints;
|
||||||
},
|
},
|
||||||
render:function(title) {
|
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) {
|
if (this.hasSource) {
|
||||||
this.helpButtons.showSource.unbind().on('click',_.bind(this.showSource,this));
|
this.$el.find('#show-source-button').unbind().on('click',_.bind(this.showSource,this)).show();
|
||||||
this.$el.append(this.helpButtons.showSource);
|
|
||||||
}
|
}
|
||||||
if (this.hasSolution) {
|
if (this.hasSolution) {
|
||||||
this.helpButtons.showSolution.unbind().on('click',_.bind(this.showSolution,this));
|
this.$el.find('#show-solution-button').unbind().on('click',_.bind(this.showSolution,this)).show();
|
||||||
this.$el.append(this.helpButtons.showSolution);
|
|
||||||
}
|
}
|
||||||
if (this.hasPlan) {
|
if (this.hasPlan) {
|
||||||
this.helpButtons.showPlan.unbind().on('click',_.bind(this.showPlan,this));
|
this.$el.find('#show-plan-button').unbind().on('click',_.bind(this.showPlan,this)).show();
|
||||||
this.$el.append(this.helpButtons.showPlan);
|
|
||||||
}
|
}
|
||||||
if (this.hasHints) {
|
if (this.hasHints) {
|
||||||
this.helpButtons.showHints.unbind().on('click',_.bind(this.showHints,this));
|
this.$el.find('#show-hints-button').unbind().on('click',_.bind(this.showHints,this)).show();
|
||||||
this.$el.append(this.helpButtons.showHints);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.helpButtons.restartLesson.unbind().on('click',_.bind(this.restartLesson,this));
|
this.$el.find('#restart-lesson-button').unbind().on('click',_.bind(this.restartLesson,this)).show();
|
||||||
this.$el.append(this.helpButtons.restartLesson);
|
//this.$el.append(this.helpButtons.restartLesson);
|
||||||
},
|
},
|
||||||
|
|
||||||
showSource: function() {
|
showSource: function() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user