diff --git a/cms/templates/js/textbook-show.underscore b/cms/templates/js/textbook-show.underscore
index 0afcdea4d3..260d8a51e7 100644
--- a/cms/templates/js/textbook-show.underscore
+++ b/cms/templates/js/textbook-show.underscore
@@ -1,11 +1,25 @@
<%= name %>
<% if(chapters.length > 1) {%>
- <%= chapters.length %> PDF Chapters
+
+
+ <%= chapters.length %> PDF Chapters
+
<% } else if(chapters.length === 1) { %>
<%= chapters.at(0).get("asset_path") %>
<% } %>
<%= gettext("view in course") %>
+ <% if(showChapters) { %>
+
+
+ <% chapters.each(function(chapter) { %>
+ - <%= chapter.get('name') %>
+ <%= chapter.get('asset_path') %>
+
+ <% }) %>
+
+ <% } %>
diff --git a/cms/templates/textbooks.html b/cms/templates/textbooks.html
index 8f02e0ddf4..273d399566 100644
--- a/cms/templates/textbooks.html
+++ b/cms/templates/textbooks.html
@@ -29,6 +29,7 @@ window.UPLOAD_ASSET_CALLBACK_URL = "${upload_asset_callback_url}"
CMS.Models.Textbook = Backbone.Model.extend({
defaults: {
name: "",
+ showChapters: false
},
initialize: function() {
this.chapters = new CMS.Collections.ChapterSet;
@@ -45,7 +46,9 @@ CMS.Views.TextbookShow = Backbone.View.extend({
},
events: {
"click .edit": "editTextbook",
- "click .delete": "removeSelf"
+ "click .delete": "removeSelf",
+ "click .show-chapters": "showChapters",
+ "click .hide-chapters": "hideChapters"
},
render: function() {
var attrs = $.extend({}, this.model.attributes);
@@ -60,6 +63,14 @@ CMS.Views.TextbookShow = Backbone.View.extend({
removeSelf: function(e) {
if(e && e.preventDefault) { e.preventDefault(); }
this.model.collection.remove(this.model);
+ },
+ showChapters: function(e) {
+ if(e && e.preventDefault) { e.preventDefault(); }
+ this.model.set('showChapters', true);
+ },
+ hideChapters: function(e) {
+ if(e && e.preventDefault) { e.preventDefault(); }
+ this.model.set('showChapters', false);
}
})
CMS.Views.TextbookEdit = Backbone.View.extend({