Fix for #46 (Lesson Help toggle plus cleaning up button text) && fix for #39

This commit is contained in:
Jason White 2015-08-25 21:11:47 -04:00
parent cc9ae0a6a9
commit 65621e51cf
4 changed files with 25 additions and 15 deletions

View File

@ -85,7 +85,7 @@ define(['jquery',
paramModel.set('stageParam',this.lessonContent.get('stageParam')); paramModel.set('stageParam',this.lessonContent.get('stageParam'));
this.paramView = new ParamView({model:paramModel}); this.paramView = new ParamView({model:paramModel});
this.hideShowHelps(null); $('.lesson-help').hide();
this.trigger('menu:reload'); this.trigger('menu:reload');
}; };
@ -122,19 +122,26 @@ define(['jquery',
if (!showId) { if (!showId) {
return; return;
} }
switch(showHelp) {
case 'plan': if ($(showId).is(':visible')) {
$(contentId).html(this.planView.model.get('content')); $(showId).hide();
break; return;
case 'solution': } else {
$(showId).html(this.solutionView.model.get('content')); //TODO: move individual .html operations into individual help views
break; switch(showHelp) {
case 'source': case 'plan':
$(contentId).html('<pre>' + this.sourceView.model.get('content') + '</pre>'); $(contentId).html(this.planView.model.get('content'));
break; break;
case 'solution':
$(showId).html(this.solutionView.model.get('content'));
break;
case 'source':
$(contentId).html('<pre>' + this.sourceView.model.get('content') + '</pre>');
break;
}
$(showId).show();
GoatUtils.scrollToHelp()
} }
$(showId).show();
GoatUtils.scrollToHelp()
}; };
this.onShowHints = function() { this.onShowHints = function() {

View File

@ -6,9 +6,9 @@ function($,_,Backbone) {
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:$('<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'}), 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]'}), 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'}), 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'}) restartLesson:$('<button>',{id:'restart-lesson-button','class':'btn btn-xs help-button',type:'button',text:'Restart Lesson'})
}, },

View File

@ -17,6 +17,7 @@ define(['jquery',
this.$el.html(this.model.get('content')); this.$el.html(this.model.get('content'));
this.makeFormsAjax(); this.makeFormsAjax();
this.ajaxifyAttackHref(); this.ajaxifyAttackHref();
$(window).scrollTop(0); //work-around til we get the scroll down sorted out
}, },
//TODO: reimplement this in custom fashion maybe? //TODO: reimplement this in custom fashion maybe?
makeFormsAjax: function () { makeFormsAjax: function () {

View File

@ -13,9 +13,11 @@ function($,
this.listenTo(this.model,'loaded',this.onModelLoaded); this.listenTo(this.model,'loaded',this.onModelLoaded);
this.model.loadData(); this.model.loadData();
}, },
render:function(title) { render:function(title) {
}, },
onModelLoaded: function() { onModelLoaded: function() {
this.trigger('plan:loaded',{'helpElement':'plan','value':true}); this.trigger('plan:loaded',{'helpElement':'plan','value':true});
} }