#42, support for stages in client router and LessonMenuService

This commit is contained in:
Jason White
2015-08-22 21:13:03 -04:00
parent 9b4c97e468
commit 7c16319c34
5 changed files with 12 additions and 10 deletions

View File

@ -39,13 +39,13 @@ define(['jquery',
this.start = function() {
this.listenTo(this.lessonContent,'contentLoaded',this.onContentLoaded);
};
//load View, which can pull data
this.loadLesson = function(scr,menu) {
this.loadLesson = function(scr,menu,stage) {
this.helpsLoaded = {};
this.lessonContent.loadData({
'screen': encodeURIComponent(scr),
'menu': encodeURIComponent(menu),
'screen': scr,
'menu': menu,
'stage': stage
});
this.planView = {};
this.solutionView = {};

View File

@ -16,13 +16,14 @@ define(['jquery',
initialize: function (options) {
this.screenParam = null;
this.menuParam = null;
this.stageParam = null;
this.baseUrlRoot = 'attack?Screen=';
},
loadData: function(options) {
this.urlRoot = this.baseUrlRoot +options.screen + '&menu=' + options.menu;
this.urlRoot = this.baseUrlRoot +options.screen + '&menu=' + options.menu + '&stage=' + options.stage;
this.set('menuParam',options.menu);
this.set('screenParam',options.screen);
this.set('stageParam',options.stage)
var self=this;
this.fetch().then(function(data) {
self.setContent(data);

View File

@ -16,7 +16,7 @@ define(['jquery',
routes: {
//#....
'welcome':'welcomeRoute',
'attack/:scr/:menu':'attackRoute' //
'attack/:scr/:menu(/:stage)':'attackRoute' //
},
lessonController: new LessonController({
@ -33,8 +33,8 @@ define(['jquery',
this.lessonController.start();
this.menuController.initMenu();
goatRouter.on('route:attackRoute', function(scr,menu) {
this.lessonController.loadLesson(scr,menu);
goatRouter.on('route:attackRoute', function(scr,menu,stage) {
this.lessonController.loadLesson(scr,menu,stage);
this.menuController.updateMenu(scr,menu);
//update menu
});