Created
September 9, 2012 19:22
-
-
Save amundo/3686675 to your computer and use it in GitHub Desktop.
trying to make a nested collection
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
window.show = function(o){ return JSON.stringify(o, null,2)} | |
app = {}; | |
app.Word = Backbone.Model.extend({ | |
}) | |
app.Words = Backbone.Collection.extend({ | |
model: app.Word, | |
localStorage : new Backbone.LocalStorage('srsly_words') | |
}) | |
app.Sentence = Backbone.Model.extend({ | |
initialize: function(){ | |
this.set({'words': new app.Words}); | |
}, | |
url : 'js/sentence_data.js', | |
parse: function(response){ | |
this.get('words').reset(response.words); | |
return response; | |
} | |
}) | |
app.Text = Backbone.Collection.extend({ | |
model: app.Sentence, | |
localStorage : new Backbone.LocalStorage('srsly_text'), | |
}) | |
$(function(){ | |
app.sentence = new app.Sentence(); | |
}) |
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
{ | |
"transcription": "hinispleʔ eč ašup, siyamš aʔoʔ", | |
"translation": "When this world perished, it was full of water", | |
"words": [ | |
{ "morphemes" : "hini-s-pleʔ", "gloss" : "when-3RD-SG-to.perish" }, | |
{ "morphemes" : "eč", "gloss" : "this" }, | |
{ "morphemes" : "ašup", "gloss" : "world" }, | |
{ "morphemes" : "s-iyam-š", "gloss" : "3RD.SG-to.be.full-INTR" }, | |
{ "morphemes" : "aʔoʔ", "gloss" : "water" } | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment