Fixing Windows issue with goatRouter --> GoatRouter

This commit is contained in:
Nanne Baars 2015-07-25 17:43:54 +02:00
parent dfac438ec0
commit 482267129c
2 changed files with 42 additions and 92 deletions

View File

@ -1,50 +1,50 @@
define(['jquery', define(['jquery',
'underscore', 'underscore',
'backbone', 'backbone',
'goatApp/controller/LessonController', 'goatApp/controller/LessonController',
'goatApp/controller/MenuController', 'goatApp/controller/MenuController',
'goatApp/view/LessonContentView', 'goatApp/view/LessonContentView',
'goatApp/view/MenuView', 'goatApp/view/MenuView',
'goatApp/view/TitleView' 'goatApp/view/TitleView'
], function ($,_,Backbone,LessonController,MenuController,LessonContentView,MenuView,TitleView) { ], function ($,_,Backbone,LessonController,MenuController,LessonContentView,MenuView,TitleView) {
var lessonView = new LessonContentView(); var lessonView = new LessonContentView();
var menuView = new MenuView(); var menuView = new MenuView();
var titleView = new TitleView(); var titleView = new TitleView();
var GoatAppRouter = Backbone.Router.extend({ var GoatAppRouter = Backbone.Router.extend({
routes: { routes: {
//#.... //#....
'welcome':'welcomeRoute', 'welcome':'welcomeRoute',
'attack/:scr/:menu':'attackRoute' // 'attack/:scr/:menu':'attackRoute' //
}, },
lessonController: new LessonController({ lessonController: new LessonController({
lessonView:lessonView lessonView:lessonView
}), }),
menuController: new MenuController({ menuController: new MenuController({
menuView:menuView, menuView:menuView,
titleView:titleView titleView:titleView
}), }),
init:function() { init:function() {
goatRouter = new GoatAppRouter(); goatRouter = new GoatAppRouter();
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) {
console.log('attack route'); console.log('attack route');
this.lessonController.loadLesson(scr,menu); this.lessonController.loadLesson(scr,menu);
this.menuController.updateMenu(scr,menu); this.menuController.updateMenu(scr,menu);
//update menu //update menu
}); });
goatRouter.on('route:welcomeRoute', function() { goatRouter.on('route:welcomeRoute', function() {
alert('welcome route'); alert('welcome route');
}); });
Backbone.history.start();
}
});
return GoatAppRouter; Backbone.history.start();
}
});
return GoatAppRouter;
}); });

View File

@ -1,50 +0,0 @@
define(['jquery',
'underscore',
'backbone',
'goatApp/controller/LessonController',
'goatApp/controller/MenuController',
'goatApp/view/LessonContentView',
'goatApp/view/MenuView',
'goatApp/view/TitleView'
], function ($,_,Backbone,LessonController,MenuController,LessonContentView,MenuView,TitleView) {
var lessonView = new LessonContentView();
var menuView = new MenuView();
var titleView = new TitleView();
var GoatAppRouter = Backbone.Router.extend({
routes: {
//#....
'welcome':'welcomeRoute',
'attack/:scr/:menu':'attackRoute' //
},
lessonController: new LessonController({
lessonView:lessonView
}),
menuController: new MenuController({
menuView:menuView,
titleView:titleView
}),
init:function() {
goatRouter = new GoatAppRouter();
this.lessonController.start();
this.menuController.initMenu();
goatRouter.on('route:attackRoute', function(scr,menu) {
console.log('attack route');
this.lessonController.loadLesson(scr,menu);
this.menuController.updateMenu(scr,menu);
//update menu
});
goatRouter.on('route:welcomeRoute', function() {
alert('welcome route');
});
Backbone.history.start();
}
});
return GoatAppRouter;
});