Don't remove all chapters on closing EditTextbook view

Previously, the code would dynamically add a chapter on render() if the textbook
had no chapters, and would remove all empty chapters when the edit view was closed.
Now, the render method doesn't modify the model at all anymore (yay!) and when the
edit view is closed, remove all empty chapters but be sure to leave at least one
left.
This commit is contained in:
David Baumgold
2013-06-24 15:21:27 -04:00
parent 0048c82092
commit 696a795c12
4 changed files with 25 additions and 19 deletions

View File

@@ -2,7 +2,7 @@ CMS.Models.Textbook = Backbone.AssociatedModel.extend({
defaults: function() {
return {
name: "",
chapters: new CMS.Collections.ChapterSet(),
chapters: new CMS.Collections.ChapterSet([{}]),
showChapters: false
};
},