Created
February 15, 2011 15:50
-
-
Save jonathan/827681 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
Uncaught TypeError: Object #<FormTemplate> has no method 'apply' backbone.js:98 | |
Backbone.Events.trigger backbone.js:98 | |
_.extend.set backbone.js:195 | |
_.extend.fetch.options.success backbone.js:257 | |
jQuery.jQuery.extend._Deferred.deferred.resolveWith jquery-1.5.js:864 | |
done jquery-1.5.js:6480 | |
jQuery.ajaxTransport.send.callback jquery-1.5.js:7251 |
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
class FormPage extends Backbone.Model | |
defaults: | |
label: 'New Page' | |
position: 0 | |
items: [] | |
class FormPageCollection extends Backbone.Collection | |
model: FormPage | |
class FormTemplate extends Backbone.Model | |
defaults: | |
version: '' | |
pages: [] | |
constructor: -> | |
super | |
@bind 'change:pages', @_initializePages() | |
@activePage = @get('pages').first() | |
_initializePages: -> | |
if _( @get 'pages' ).isEmpty() | |
@set { pages: FormPageCollection } | |
newPage = new FormPage | |
@get('pages').add newPage | |
else | |
@set { pages: new FormPageCollection @get('pages') } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment