Skip to content

Instantly share code, notes, and snippets.

@eastridge
Created June 25, 2013 18:42
Show Gist options
  • Save eastridge/5861123 to your computer and use it in GitHub Desktop.
Save eastridge/5861123 to your computer and use it in GitHub Desktop.
## 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