Created
June 25, 2013 18:42
-
-
Save eastridge/5861123 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Old View Style | |
//js | |
Thorax.View.extend({ | |
name: 'view-name' | |
}); | |
Thorax.Views['view-name'] | |
//handlebars | |
{{view "view-name"}} | |
//lumbar.json | |
{ | |
"modules": { | |
"modueName": { | |
"routes": { | |
}, | |
"scripts": [ | |
"view-name" | |
] | |
} | |
} | |
} | |
## New View Style | |
defineView(['child-view', 'collections/blah'], function(ChildView, BlahCollection) { | |
return Thorax.View.extend({ | |
initialize: function() { | |
this.collection = new BlahCollection(); | |
this.child = new ChildView; | |
} | |
}); | |
}); | |
{{view child}} | |
## New Router Style | |
defineRouter('home',[ | |
"views/home.js", | |
"views/app-download.js", | |
"models/item-helpers.js", | |
"models/merch-header.js", | |
"collections/manual-shelf.js", | |
"views/merchandising.js", | |
"views/home/merch-loader.js", | |
"views/home/merch-carousel.js", | |
"views/home/merch-buttons.js", | |
"views/home/countdown.js", | |
"views/votd.js" | |
],{ | |
"cart": "cart", | |
"cart/:shippingOptionFailed": "cart", | |
"signin": "signin", | |
"signin/*destination": "signin" | |
}, function( | |
HomeView, | |
AppDownloadView, | |
ItemHelperModel, | |
... | |
) { | |
return Backbone.Router.extend({ | |
cart: function() { | |
}, | |
signin: function() { | |
} | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment