Created
May 24, 2012 14:10
-
-
Save jedschneider/2781772 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
| ServiceRequest = Backbone.Model.extend | |
| initialize: (attrs) -> | |
| # Is there a simple way to extract this pseudo-model functionality | |
| # into a superclass? | |
| _.bindAll @, 'set_line_items', | |
| @bind('change', @set_line_items) | |
| @set_line_items() | |
| set_line_items: -> | |
| if(@attributes.line_items and not(@line_items instanceof LineItemList)) | |
| @line_items = new LineItemList(new LineItem(li) for li in @attributes.line_items) | |
| @line_items.bind 'change', => @trigger 'change' | |
| # more line item events bound here. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment