diff --git a/src/main/webapp/js/goatApp/view/goatRouter.js b/src/main/webapp/js/goatApp/view/goatRouter.js index 6b5a21a2d..20e1f786d 100644 --- a/src/main/webapp/js/goatApp/view/goatRouter.js +++ b/src/main/webapp/js/goatApp/view/goatRouter.js @@ -4,41 +4,47 @@ define(['jquery', 'goatApp/controller/LessonController', 'goatApp/controller/MenuController', 'goatApp/view/LessonContentView', - 'goatApp/view/MenuView' - ], function ($,_,Backbone,LessonController,MenuController,LessonContentView,MenuView) { + 'goatApp/view/MenuView', + 'goatApp/view/TitleView' +], function ($,_,Backbone,LessonController,MenuController,LessonContentView,MenuView,TitleView) { - var lessonView = new LessonContentView(); - var menuView = new MenuView(); - var GoatAppRouter = Backbone.Router.extend({ - routes: { - //#.... - 'welcome':'welcomeRoute', - 'attack/:scr/:menu':'attackRoute' // - }, - lessoonController: lessoonController({ - lessonView:lessonView - }), - menuView: new MenuController({ - menuView:menuView - }) - }); + var lessonView = new LessonContentView(); + var menuView = new MenuView(); + var titleView = new TitleView(); - var init = function() { + 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'); }); - // init the history/router + Backbone.history.start(); } + }); - return { - init:init - }; + return GoatAppRouter; }); \ No newline at end of file