Created
March 25, 2013 19:56
-
-
Save daGrevis/5240127 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| jQuery -> | |
| class MyModel extends Backbone.Model | |
| parse: (response) -> | |
| response.objects | |
| class ItemModel extends MyModel | |
| class ItemsCollection extends Backbone.Collection | |
| url: "/api/v1/item/" | |
| model: ItemModel | |
| class CategoryModel extends Backbone.Model | |
| class CategoriesCollection extends Backbone.Collection | |
| model: ItemModel | |
| class ItemsView extends Backbone.View | |
| el: $ "#items" | |
| initialize: -> | |
| _.bindAll @ | |
| @items_collection = new ItemsCollection | |
| @items_collection.on "sync", @render | |
| @items_collection.fetch() | |
| render: -> | |
| $(@el).text "Hello, world!" | |
| items_view = new ItemsView |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment