Created
August 2, 2011 06:01
-
-
Save inklesspen/1119662 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
| leeuwenhoek.models.Scene = Backbone.Model.extend({ | |
| defaults: { | |
| 'question': 'What?', | |
| 'setting': 'Where, when, and who?', | |
| 'answer': 'What?', | |
| 'tone': 'light' | |
| } | |
| }); | |
| leeuwenhoek.models.SceneList = Backbone.Collection.extend({ | |
| model: leeuwenhoek.models.Scene | |
| }); | |
| leeuwenhoek.models.Event = Backbone.Model.extend({ | |
| defaults: { | |
| 'description': 'Describe Me', | |
| 'tone': 'light' | |
| }, | |
| initialize: function(attrs, opts) { | |
| this.set({'scenes': new leeuwenhoek.models.SceneList(attrs.scenes)}); | |
| }, | |
| toJSON: function() { | |
| var json = Backbone.Model.prototype.toJSON.call(this); | |
| json['scenes'] = json['scenes'].toJSON(); | |
| return json; | |
| } | |
| }); | |
| leeuwenhoek.models.EventList = Backbone.Collection.extend({ | |
| model: leeuwenhoek.models.Event | |
| }); | |
| leeuwenhoek.models.Period = Backbone.Model.extend({ | |
| defaults: { | |
| "description": "Describe Me", | |
| "tone": "light", | |
| "comment": "" | |
| }, | |
| initialize: function(attrs, opts) { | |
| this.set({'events': new leeuwenhoek.models.EventList(attrs.events)}); | |
| }, | |
| toJSON: function() { | |
| var json = Backbone.Model.prototype.toJSON.call(this); | |
| json['events'] = json['events'].toJSON(); | |
| return json; | |
| } | |
| }); | |
| leeuwenhoek.models.PeriodList = Backbone.Collection.extend({ | |
| model: leeuwenhoek.models.Period | |
| }); | |
| leeuwenhoek.models.History = Backbone.Model.extend({ | |
| defaults: { | |
| 'bigPicture': 'Stuff happens' | |
| }, | |
| initialize: function(attrs, opts) { | |
| this.set({'periods': new leeuwenhoek.models.PeriodList(attrs.periods)}); | |
| }, | |
| toJSON: function() { | |
| var json = Backbone.Model.prototype.toJSON.call(this); | |
| json['periods'] = json['periods'].toJSON(); | |
| return json; | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment