PDF Textbooks: implemented "View Live" link
This commit is contained in:
committed by
David Baumgold
parent
2a92a14054
commit
b41d23747a
@@ -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});
|
||||
|
||||
Reference in New Issue
Block a user