Commit b41d2374 by Frances Botsford Committed by David Baumgold

PDF Textbooks: implemented "View Live" link

parent 2a92a140
......@@ -12,7 +12,10 @@ CMS.Views.ShowTextbook = Backbone.View.extend({
"click .hide-chapters": "hideChapters"
},
render: function() {
this.$el.html(this.template(this.model.attributes));
var attrs = $.extend({}, this.model.attributes);
attrs.bookindex = this.model.collection.indexOf(this.model);
attrs.course = window.section.attributes;
this.$el.html(this.template(attrs));
return this;
},
editTextbook: function(e) {
......
......@@ -34,7 +34,7 @@
<ul class="actions textbook-actions">
<li class="action action-view">
<button class="view"><%= gettext("View Live") %></button>
<a href="//<%= CMS.URL.LMS_BASE %>/courses/<%= course.org %>/<%= course.num %>/<%= course.url_name %>/pdfbook/<%= bookindex %>/" class="view"><%= gettext("View Live") %></a>
</li>
<li class="action action-edit">
<button class="edit"><%= gettext("Edit") %></button>
......
......@@ -18,9 +18,14 @@
<script type="text/javascript">
CMS.URL.UPLOAD_ASSET = "${upload_asset_url}"
CMS.URL.TEXTBOOKS = "${textbook_url}"
CMS.URL.LMS_BASE = "${settings.LMS_BASE}"
window.section = new CMS.Models.Section({
id: "${course.id}",
name: "${course.display_name_with_default | h}"
name: "${course.display_name_with_default | h}",
url_name: "${course.location.name | h}",
org: "${course.location.org | h}",
num: "${course.location.course | h}",
revision: "${course.location.revision | h}"
});
var textbooks = new CMS.Collections.TextbookSet(${json.dumps(course.pdf_textbooks)}, {parse: true});
var tbView = new CMS.Views.ListTextbooks({collection: textbooks});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment