Instead, we use XModule field default values when creating an empty
XModule. Driven by this use case, we also allow for XModules to be
created in memory without being persisted to the database at all. This
necessitates a change to the Modulestore api, replacing clone_item with
create_draft and save_xmodule.
Previously, for a textbook with only one chapter, we allowed that chapter to
not have a title -- under the assumption that it would be shown as a monolithic
textbook, instead of a chaptered textbook. However, the UI doesn't support that
idea, the code was getting a bit messy, and there was no real benefit to the idea
of not having to specify a chapter title. This commit removes that special case,
and ensures that all textbook chapters must have a name and an asset path.
Previously, when a model was deleted, the entire collection would save itself
to the server again. Now, we just call model.destroy(), which doesn't affect
other models.
Created a few RESTful API endpoints, which required creating and assigning
arbitrary IDs to PDF textbooks. Changed the Backbone views to save individual
models, instead of saving a whole collection.
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.
Textbooks now have an empty chapterset by default, instead of one with one empty
chapter. The TextbookEdit view dynamically adds an empty chapter if the chapterset
is empty; the close button removes all empty chapters from the chapterset.
On Linux, coffeescript refuses to compile unless the `catch` keyword has an error
variable to bind to. On Mac, it works just fine either way. Go figure.
Handle secondary actions on notifications either specified as a single object,
or as a list of objects. Under the hood, the initialize method converts a single
object to a list containing a single object.