Fix static urls in pdf_viewer.html to correctly display pdf viewer for course text books

This commit is contained in:
danial
2018-12-13 17:38:51 +05:00
committed by danialmalik
parent 559069d5d2
commit ea53c3922d
2 changed files with 12 additions and 15 deletions

View File

@@ -31,10 +31,7 @@ logger = logging.getLogger(__name__)
%></%def>
<%def name='url(file, raw=False)'><%
try:
url = staticfiles_storage.url(file)
except:
url = file
url = staticfiles_storage.url(file)
## HTML-escaping must be handled by caller
%>${url | n, decode.utf8}${"?raw" if raw else ""}</%def>

View File

@@ -32,23 +32,23 @@ http://sourceforge.net/adobe/cmap/wiki/License/
<meta name="path_prefix" content="${EDX_ROOT_URL}">
<title>${current_chapter['title'] if current_chapter else ''}</title>
<link rel="stylesheet" href="${static.url('/static/css/vendor/pdfjs/viewer.css')}"/>
<link rel="stylesheet" href="${static.url('css/vendor/pdfjs/viewer.css')}"/>
<script type="text/javascript" src="${static.url('/static/js/vendor/pdfjs/compatibility.js')}"></script>
<script type="text/javascript" src="${static.url('js/vendor/pdfjs/compatibility.js')}"></script>
<!-- This snippet is used in production (included from viewer.html) -->
<link rel="resource" type="application/l10n" href="${static.url('/static/js/vendor/pdfjs/locale/locale.properties')}"/>
<script type="text/javascript" src="${static.url('/static/js/vendor/pdfjs/l10n.js')}"></script>
<script type="text/javascript" src="${static.url('/static/js/vendor/pdfjs/pdf.js')}"></script>
<link rel="resource" type="application/l10n" href="${static.url('js/vendor/pdfjs/locale/locale.properties')}"/>
<script type="text/javascript" src="${static.url('js/vendor/pdfjs/l10n.js')}"></script>
<script type="text/javascript" src="${static.url('js/vendor/pdfjs/pdf.js')}"></script>
<script type="text/javascript">
PDFJS.imageResourcesPath = "${static.url('/static/css/vendor/pdfjs/images/') | n, js_escaped_string}";
PDFJS.workerSrc = "${static.url('/static/js/vendor/pdfjs/pdf.worker.js') | n, js_escaped_string}";
PDFJS.cMapUrl = "${static.url('/static/css/vendor/pdfjs/cmaps/') | n, js_escaped_string}";
PDFJS.imageResourcesPath = "${static.url('css/vendor/pdfjs/images/') | n, js_escaped_string}";
PDFJS.workerSrc = "${static.url('js/vendor/pdfjs/pdf.worker.js') | n, js_escaped_string}";
PDFJS.cMapUrl = "${static.url('css/vendor/pdfjs/cmaps/') | n, js_escaped_string}";
PDF_URL = '${current_url | n, js_escaped_string}';
</script>
<script ${static.url('/static/js/vendor/pdfjs/debugger.js')}></script>
<script ${static.url('js/vendor/pdfjs/debugger.js')}></script>
<%static:js group='main_vendor'/>
<%static:js group='application'/>
@@ -417,7 +417,7 @@ http://sourceforge.net/adobe/cmap/wiki/License/
</div>
</div>
</div>
<script type="text/javascript" src="${static.url('/static/js/vendor/pdfjs/viewer.js')}"></script>
<script type="text/javascript" src="${static.url('/static/js/pdf-analytics.js')}"></script>
<script type="text/javascript" src="${static.url('js/vendor/pdfjs/viewer.js')}"></script>
<script type="text/javascript" src="${static.url('js/pdf-analytics.js')}"></script>
</body>
</html>