textbooks.html 3.24 KB
Newer Older
1
<%inherit file="base.html" />
2
<%def name="online_help_token()"><% return "textbooks" %></%def>
3
<%namespace name='static' file='static_content.html'/>
4
<%! import json %>
5
<%! from django.utils.translation import ugettext as _ %>
6

David Baumgold committed
7
<%block name="title">${_("Textbooks")}</%block>
8
<%block name="bodyclass">is-signedin course view-textbooks</%block>
9

10
<%block name="header_extras">
11
% for template_name in ["edit-textbook", "show-textbook", "edit-chapter", "no-textbooks", "basic-modal", "modal-button", "upload-dialog"]:
12 13
  <script type="text/template" id="${template_name}-tpl">
    <%static:include path="js/${template_name}.underscore" />
14
  </script>
15
% endfor
16 17 18 19
</%block>

<%block name="jsextra">
<script type="text/javascript">
20 21
window.CMS = window.CMS || {};
CMS.URL = CMS.URL || {};
22
CMS.URL.UPLOAD_ASSET = "${upload_asset_url}"
23
CMS.URL.TEXTBOOKS = "${textbook_url}"
24
CMS.URL.LMS_BASE = "${settings.LMS_BASE}"
25 26
require(["js/models/section", "js/collections/textbook", "js/views/list_textbooks"],
        function(Section, TextbookCollection, ListTextbooksView) {
27
  var textbooks = new TextbookCollection(${json.dumps(textbooks)}, {parse: true});
28
  var tbView = new ListTextbooksView({collection: textbooks});
29

30 31 32 33 34 35 36 37
  $(function() {
      $(".content-primary").append(tbView.render().el);
      $(".nav-actions .new-button").click(function(e) {
          tbView.addOne(e);
      })
      $(window).on("beforeunload", function() {
          var dirty = textbooks.find(function(textbook) { return textbook.isDirty(); });
          if(dirty) {
38
              return "${_('You have unsaved changes. Do you really want to leave this page?')}";
39 40 41 42
          }
      })
  })
});
43 44 45
</script>
</%block>

46 47 48 49
<%block name="content">
  <div class="wrapper-mast wrapper">
    <header class="mast has-actions has-subtitle">
      <h1 class="page-header">
50
        <small class="subtitle">${_("Content")}</small>
David Baumgold committed
51
        <span class="sr">&gt; </span>${_("Textbooks")}
52
      </h1>
53 54

      <nav class="nav-actions">
David Baumgold committed
55
        <h3 class="sr">${_("Page Actions")}</h3>
56 57
        <ul>
          <li class="nav-item">
58
            <a href="#" class="button new-button"><i class="icon-plus"></i> ${_("New Textbook")}</a>
59 60 61
          </li>
        </ul>
      </nav>
62 63 64
    </header>
  </div>

65
  <div class="wrapper-content wrapper">
66
    <section class="content">
67 68 69 70 71
      <article class="content-primary" role="main">

      </article>
      <aside class="content-supplementary" role="complimentary">
        <div class="bit">
72 73
          <h3 class="title-3">${_("Why should I break my textbook into chapters?")}</h3>
          <p>${_("Breaking your textbook into multiple chapters reduces loading times for students, especially those with slow Internet connections. Breaking up textbooks into chapters can also help students more easily find topic-based information.")}</p>
74
        </div>
75
        <div class="bit">
76
          <h3 class="title-3">${_("What if my book isn't divided into chapters?")}</h3>
77
          <p>${_("If your textbook doesn't have individual chapters, you can upload the entire text as a single chapter and enter a name of your choice in the Chapter Name field.")}</p>
78
          <p><a href="${get_online_help_info(online_help_token())['doc_url']}" target="_blank">${_("Learn More")}</a></p>
79
        </div>
80
      </aside>
81
    </section>
82 83
  </div>
</%block>