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,6 +122,12 @@ define(['jquery',
if (!showId) { if (!showId) {
return; return;
} }
if ($(showId).is(':visible')) {
$(showId).hide();
return;
} else {
//TODO: move individual .html operations into individual help views
switch(showHelp) { switch(showHelp) {
case 'plan': case 'plan':
$(contentId).html(this.planView.model.get('content')); $(contentId).html(this.planView.model.get('content'));
@ -135,6 +141,7 @@ define(['jquery',
} }
$(showId).show(); $(showId).show();
GoatUtils.scrollToHelp() 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});
} }