incremental UI changes

This commit is contained in:
Jason White
2016-07-05 08:16:32 -04:00
parent c350e86772
commit d27712affa
8 changed files with 121 additions and 122 deletions

View File

@ -22,9 +22,9 @@ define(['jquery',
var GoatAppRouter = Backbone.Router.extend({
routes: {
'welcome':'welcomeRoute',
'attack/:scr/:menu':'attackRoute',
'attack/:scr/:menu/:stage':'attackRoute',
'attack/:scr/:menu/*stage/:num':'attackRoute',
'lesson/:name':'lessonRoute'
//'attack/:scr/:menu/:stage':'attackRoute',
//'attack/:scr/:menu/*stage/:num':'attackRoute',
},
lessonController: new LessonController({
@ -40,16 +40,21 @@ define(['jquery',
this.lessonController.start();
// this.menuController.initMenu();
goatRouter.on('route:attackRoute', function(scr,menu,stage,num) {
this.lessonController.loadLesson(scr,menu,stage,num);
this.menuController.updateMenu(scr,menu);
// goatRouter.on('route:attackRoute', function(scr,menu,stage,num) {
// this.lessonController.loadLesson(scr,menu,stage,num);
// this.menuController.updateMenu(scr,menu);
// });
goatRouter.on('route:lessonRoute', function(name) {
console.log('lesson route initiated');
this.lessonController.loadLesson(name);
//TODO - update menu code from below
this.menuController.updateMenu(name);
});
goatRouter.on('route:welcomeRoute', function() {
this.lessonController.loadWelcome();
});
goatRouter.on("route", function(route, params) {
});
goatRouter.on("route", function(route, params) {});
Backbone.history.start();
this.listenTo(this.lessonController, 'menu:reload',this.reloadMenu)

View File

@ -32,9 +32,7 @@ function($,_,Backbone) {
if (true) { //FIXME: change to this.hasAttack
this.$el.find('#show-attack-button').unbind().on('click',_.bind(this.showAttack,this)).show();
}
if (this.hasHints) {
this.$el.find('#show-hints-button').unbind().on('click',_.bind(this.showHints,this)).show();
}
this.$el.find('#restart-lesson-button').unbind().on('click',_.bind(this.restartLesson,this)).show();
//this.$el.append(this.helpButtons.restartLesson);
@ -52,9 +50,6 @@ function($,_,Backbone) {
this.trigger('attack:show',{show:true});
},
showHints: function() {
this.trigger('hints:show','hints');
},
restartLesson: function() {
this.trigger('lesson:restart');
}

View File

@ -19,13 +19,23 @@ function($,
this.hideHints();
},
isVisible: function() {
return this.$el.is(':visible');
},
toggleLabel: function() {
this.$el.text((showing) ? 'Hide hints' : 'Show hints');
},
render:function() {
if (this.$el.is(':visible')) {
if (this.isVisible()) {
this.$el.hide(350);
} else {
this.$el.show(350);
}
this.toggleLabel()
if (this.collection.length > 0) {
this.hideShowPrevNextButtons();
}