Skip to content

Instantly share code, notes, and snippets.

@rissajeanne
Created February 22, 2012 22:19
Show Gist options
  • Save rissajeanne/1887854 to your computer and use it in GitHub Desktop.
Save rissajeanne/1887854 to your computer and use it in GitHub Desktop.
ABS.View.PassagePanelBrowse = Backbone.View.extend({
initialize : function() {
var that = this;
_.bindAll(this, 'render');
this.bind('passage:change', this.render);
},
render : function(options) {
var that = this;
$(this.el).append(ABS.jst.PassageBrowseDropdown());
if (options) {
this.bookList = ABS.spi.allVersions.get(options.get('version').id).books;
if (this.bookList.length == 0) {
this.bookList.fetch();
}
this._bookListView = new ABS.View.BookList({
collection : this.bookList,
el : that.$('.books ul')
}).render();
this.chapterList = new ABS.Model.Book(options.get('book')).chapters;
if (this.chapterList.length == 0) {
this.chapterList.fetch();
}
this._chapterListView = new ABS.View.ChapterList({
collection : this.chapterList,
el : that.$('.chapters ul')
}).render();
}
return this;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment