From 2b9ed46440039ca6d7dfd57cc5203e7d7c1ac4ed Mon Sep 17 00:00:00 2001 From: David Baumgold Date: Thu, 27 Jun 2013 16:26:52 -0400 Subject: [PATCH] Save chapter information more frequently --- cms/static/js/views/textbook.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cms/static/js/views/textbook.js b/cms/static/js/views/textbook.js index 907cddd239..89d2b0cb5c 100644 --- a/cms/static/js/views/textbook.js +++ b/cms/static/js/views/textbook.js @@ -219,10 +219,22 @@ CMS.Views.EditChapter = Backbone.View.extend({ return this; }, events: { + "change .chapter-name": "changeName", + "change .chapter-asset-path": "changeAssetPath", "click .action-close": "removeChapter", "click .action-upload": "openUploadDialog", "submit": "uploadAsset" }, + changeName: function(e) { + if(e && e.preventDefault) { e.preventDefault(); } + this.model.set("name", this.$(".chapter-name").val()); + return this; + }, + changeAssetPath: function(e) { + if(e && e.preventDefault) { e.preventDefault(); } + this.model.set("asset_path", this.$(".chapter-asset-path").val()); + return this; + }, removeChapter: function(e) { if(e && e.preventDefault) { e.preventDefault(); } this.model.collection.remove(this.model);