Skip to content

Instantly share code, notes, and snippets.

@rissajeanne
Created February 21, 2012 18:03
Show Gist options
  • Save rissajeanne/1877876 to your computer and use it in GitHub Desktop.
Save rissajeanne/1877876 to your computer and use it in GitHub Desktop.
ABS.Model.PassagePanel = Backbone.Model.extend({
initialize: function () {
this.updateBooks();
},
updateBooks: function () {
var that = this,
versions = new ABS.Collection.VersionList(ABS.bootstrap.versions),
getBookOrd = function (book) { return book.get('ord'); };
var version = versions.get(this.id);
version.books.fetch({
success: function (books) {
var attributes = {};
_.each(books.models, function (book) {
book.chapters.fetch();
});
attributes.books = books.models;
that.set(attributes);
}
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment