recent changes, commit prior to merge
This commit is contained in:
23
src/main/webapp/js/goatApp/view/LessonContentView.js
Normal file
23
src/main/webapp/js/goatApp/view/LessonContentView.js
Normal file
@ -0,0 +1,23 @@
|
||||
//LessonContentView
|
||||
define(['jquery',
|
||||
'underscore',
|
||||
'backbone',
|
||||
'goatApp/model/LessonContentData'],
|
||||
function($,_,Backbone,LessonData) {
|
||||
var contentView = Backbone.View.extend({
|
||||
el:'#lessonContent',
|
||||
initialize: function(options) {
|
||||
//this.content = options.content;
|
||||
this.lessonData = {};
|
||||
this.listenTo(this.lessonData,'sync',this.render);
|
||||
},
|
||||
loadLesson: function(options) {
|
||||
this.lessonData = new LessonData(options.screen,options.menu);
|
||||
|
||||
},
|
||||
render: function() {
|
||||
alert('render');
|
||||
this.$el.html(this.content);
|
||||
}
|
||||
});
|
||||
});
|
@ -1,4 +1,4 @@
|
||||
define(['jquery','underscore','backbone','goatApp/model/goatMenu'], function($,_,Backbone,MenuData) {
|
||||
define(['jquery','underscore','backbone','goatApp/model/MenuData'], function($,_,Backbone,MenuData) {
|
||||
|
||||
return Backbone.View.extend({
|
||||
el:'#menuContainer',
|
||||
|
@ -1,34 +1,44 @@
|
||||
define(['jquery',
|
||||
'underscore',
|
||||
'backbone',
|
||||
'goatApp/controller/LessonController'
|
||||
], function ($,_,Backbone,LessonController) {
|
||||
var GoatAppRouter = Backbone.Router.extend({
|
||||
routes: {
|
||||
//#....
|
||||
'welcome':'welcomeRoute',
|
||||
'attack/:scr/:menu':'attackRoute' //
|
||||
},
|
||||
lessonController: new LessonController()
|
||||
});
|
||||
'goatApp/controller/LessonController',
|
||||
'goatApp/controller/MenuController',
|
||||
'goatApp/view/LessonContentView',
|
||||
'goatApp/view/MenuView'
|
||||
], function ($,_,Backbone,LessonController,MenuController,LessonView,MenuView) {
|
||||
|
||||
|
||||
|
||||
var init = function() {
|
||||
goatRouter = new GoatAppRouter();
|
||||
|
||||
goatRouter.on('route:attackRoute', function(scr,menu) {
|
||||
this.lessonController.loadLesson(scr,menu);
|
||||
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
|
||||
});
|
||||
});
|
||||
goatRouter.on('route:welcomeRoute', function() {
|
||||
alert('welcome route');
|
||||
});
|
||||
// init the history/router
|
||||
Backbone.history.start();
|
||||
}
|
||||
|
||||
return {
|
||||
init:init
|
||||
};
|
||||
var init = function() {
|
||||
goatRouter = new GoatAppRouter();
|
||||
|
||||
goatRouter.on('route:attackRoute', function(scr,menu) {
|
||||
this.lessonController.loadLesson(scr,menu);
|
||||
//update menu
|
||||
});
|
||||
goatRouter.on('route:welcomeRoute', function() {
|
||||
alert('welcome route');
|
||||
});
|
||||
// init the history/router
|
||||
Backbone.history.start();
|
||||
}
|
||||
|
||||
return {
|
||||
init:init
|
||||
};
|
||||
|
||||
});
|
Reference in New Issue
Block a user