#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("/");
|
||||
link.append(getCategory().getRanking());
|
||||
|
||||
return link.toString();
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ public class LessonMenuService extends BaseService {
|
||||
LessonMenuItem stageItem = new LessonMenuItem();
|
||||
stageItem.setName("Stage " + stageIdx + ": " + stage);
|
||||
// build the link for the stage
|
||||
String stageLink = lessonLink + "&stage=" + stageIdx;
|
||||
String stageLink = lessonLink + "/" + stageIdx;
|
||||
stageItem.setLink(stageLink);
|
||||
stageItem.setType(LessonMenuItemType.STAGE);
|
||||
if (rla.isStageComplete(ws, stage)) {
|
||||
|
@ -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 = {};
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user