Commit b645ffeb authored by Addy Osmani's avatar Addy Osmani

Merge pull request #1185 from samccone/sjs/remove-application-regions

Update Marionette & Remove Deprecated Feature use
parents 550ac303 4ae8c9f6
...@@ -2,6 +2,16 @@ ...@@ -2,6 +2,16 @@
'use strict'; 'use strict';
TodoMVC.module('Layout', function (Layout, App, Backbone) { TodoMVC.module('Layout', function (Layout, App, Backbone) {
Layout.Root = Backbone.Marionette.LayoutView.extend({
el: '#todoapp',
regions: {
header: '#header',
main: '#main',
footer: '#footer'
}
});
// Layout Header View // Layout Header View
// ------------------ // ------------------
Layout.Header = Backbone.Marionette.ItemView.extend({ Layout.Header = Backbone.Marionette.ItemView.extend({
......
...@@ -34,18 +34,18 @@ TodoMVC.module('TodoList', function (TodoList, App, Backbone, Marionette) { ...@@ -34,18 +34,18 @@ TodoMVC.module('TodoList', function (TodoList, App, Backbone, Marionette) {
var header = new App.Layout.Header({ var header = new App.Layout.Header({
collection: todoList collection: todoList
}); });
App.header.show(header); App.root.showChildView('header', header);
}, },
showFooter: function (todoList) { showFooter: function (todoList) {
var footer = new App.Layout.Footer({ var footer = new App.Layout.Footer({
collection: todoList collection: todoList
}); });
App.footer.show(footer); App.root.showChildView('footer', footer);
}, },
showTodoList: function (todoList) { showTodoList: function (todoList) {
App.main.show(new TodoList.Views.ListView({ App.root.showChildView('main', new TodoList.Views.ListView({
collection: todoList collection: todoList
})); }));
}, },
......
...@@ -3,7 +3,13 @@ ...@@ -3,7 +3,13 @@
// TodoMVC is global for developing in the console // TodoMVC is global for developing in the console
// and functional testing. // and functional testing.
window.TodoMVC = new Backbone.Marionette.Application(); var App = Backbone.Marionette.Application.extend({
setRootLayout: function() {
this.root = new TodoMVC.Layout.Root();
}
});
window.TodoMVC = new App();
(function () { (function () {
var filterState = new Backbone.Model({ var filterState = new Backbone.Model({
...@@ -15,12 +21,7 @@ window.TodoMVC = new Backbone.Marionette.Application(); ...@@ -15,12 +21,7 @@ window.TodoMVC = new Backbone.Marionette.Application();
}); });
})(); })();
TodoMVC.addRegions({
header: '#header',
main: '#main',
footer: '#footer'
});
TodoMVC.on('start', function () { TodoMVC.on('start', function () {
Backbone.history.start(); TodoMVC.setRootLayout();
Backbone.history.start();
}); });
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
"dependencies": { "dependencies": {
"backbone": "^1.1.2", "backbone": "^1.1.2",
"backbone.localstorage": "^1.1.6", "backbone.localstorage": "^1.1.6",
"backbone.marionette": "^2.3.2", "backbone.marionette": "^2.4.1",
"jquery": "^1.11.2", "jquery": "^1.11.2",
"todomvc-app-css": "^1.0.1", "todomvc-app-css": "^1.0.1",
"todomvc-common": "^1.0.1", "todomvc-common": "^1.0.1",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment