#42, support for stages in client router and LessonMenuService
This commit is contained in:
parent
9b4c97e468
commit
7c16319c34
@ -567,6 +567,7 @@ public abstract class AbstractLesson extends Screen implements Comparable<Object
|
|||||||
link.append(getScreenId());
|
link.append(getScreenId());
|
||||||
link.append("/");
|
link.append("/");
|
||||||
link.append(getCategory().getRanking());
|
link.append(getCategory().getRanking());
|
||||||
|
|
||||||
return link.toString();
|
return link.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ public class LessonMenuService extends BaseService {
|
|||||||
LessonMenuItem stageItem = new LessonMenuItem();
|
LessonMenuItem stageItem = new LessonMenuItem();
|
||||||
stageItem.setName("Stage " + stageIdx + ": " + stage);
|
stageItem.setName("Stage " + stageIdx + ": " + stage);
|
||||||
// build the link for the stage
|
// build the link for the stage
|
||||||
String stageLink = lessonLink + "&stage=" + stageIdx;
|
String stageLink = lessonLink + "/" + stageIdx;
|
||||||
stageItem.setLink(stageLink);
|
stageItem.setLink(stageLink);
|
||||||
stageItem.setType(LessonMenuItemType.STAGE);
|
stageItem.setType(LessonMenuItemType.STAGE);
|
||||||
if (rla.isStageComplete(ws, stage)) {
|
if (rla.isStageComplete(ws, stage)) {
|
||||||
|
@ -39,13 +39,13 @@ define(['jquery',
|
|||||||
this.start = function() {
|
this.start = function() {
|
||||||
this.listenTo(this.lessonContent,'contentLoaded',this.onContentLoaded);
|
this.listenTo(this.lessonContent,'contentLoaded',this.onContentLoaded);
|
||||||
};
|
};
|
||||||
|
|
||||||
//load View, which can pull data
|
//load View, which can pull data
|
||||||
this.loadLesson = function(scr,menu) {
|
this.loadLesson = function(scr,menu,stage) {
|
||||||
this.helpsLoaded = {};
|
this.helpsLoaded = {};
|
||||||
this.lessonContent.loadData({
|
this.lessonContent.loadData({
|
||||||
'screen': encodeURIComponent(scr),
|
'screen': scr,
|
||||||
'menu': encodeURIComponent(menu),
|
'menu': menu,
|
||||||
|
'stage': stage
|
||||||
});
|
});
|
||||||
this.planView = {};
|
this.planView = {};
|
||||||
this.solutionView = {};
|
this.solutionView = {};
|
||||||
|
@ -16,13 +16,14 @@ define(['jquery',
|
|||||||
initialize: function (options) {
|
initialize: function (options) {
|
||||||
this.screenParam = null;
|
this.screenParam = null;
|
||||||
this.menuParam = null;
|
this.menuParam = null;
|
||||||
|
this.stageParam = null;
|
||||||
this.baseUrlRoot = 'attack?Screen=';
|
this.baseUrlRoot = 'attack?Screen=';
|
||||||
},
|
},
|
||||||
loadData: function(options) {
|
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('menuParam',options.menu);
|
||||||
this.set('screenParam',options.screen);
|
this.set('screenParam',options.screen);
|
||||||
|
this.set('stageParam',options.stage)
|
||||||
var self=this;
|
var self=this;
|
||||||
this.fetch().then(function(data) {
|
this.fetch().then(function(data) {
|
||||||
self.setContent(data);
|
self.setContent(data);
|
||||||
|
@ -16,7 +16,7 @@ define(['jquery',
|
|||||||
routes: {
|
routes: {
|
||||||
//#....
|
//#....
|
||||||
'welcome':'welcomeRoute',
|
'welcome':'welcomeRoute',
|
||||||
'attack/:scr/:menu':'attackRoute' //
|
'attack/:scr/:menu(/:stage)':'attackRoute' //
|
||||||
},
|
},
|
||||||
|
|
||||||
lessonController: new LessonController({
|
lessonController: new LessonController({
|
||||||
@ -33,8 +33,8 @@ define(['jquery',
|
|||||||
this.lessonController.start();
|
this.lessonController.start();
|
||||||
this.menuController.initMenu();
|
this.menuController.initMenu();
|
||||||
|
|
||||||
goatRouter.on('route:attackRoute', function(scr,menu) {
|
goatRouter.on('route:attackRoute', function(scr,menu,stage) {
|
||||||
this.lessonController.loadLesson(scr,menu);
|
this.lessonController.loadLesson(scr,menu,stage);
|
||||||
this.menuController.updateMenu(scr,menu);
|
this.menuController.updateMenu(scr,menu);
|
||||||
//update menu
|
//update menu
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user