metadata-edit.html 1.65 KB
Newer Older
1
<%! from django.utils.translation import ugettext as _ %>
2
<%namespace name='static' file='../static_content.html'/>
3

4 5
<%
  import hashlib
6
  import copy
7
  import json
8
  from xmodule.modulestore import EdxJSONEncoder
9
  hlskey = hashlib.md5(module.location.to_deprecated_string().encode('utf-8')).hexdigest()
Abdallah committed
10
%>
11

12 13 14 15
## js templates
<script id="metadata-editor-tpl" type="text/template">
    <%static:include path="js/metadata-editor.underscore" />
</script>
polesye committed
16
% for template_name in ["metadata-number-entry", "metadata-string-entry", "metadata-option-entry", "metadata-list-entry", "metadata-dict-entry", "metadata-file-uploader-entry", "metadata-file-uploader-item"]:
17 18 19 20
    <script id="${template_name}" type="text/template">
        <%static:include path="js/${template_name}.underscore" />
    </script>
% endfor
21

22
<% showHighLevelSource='source_code' in editable_metadata_fields and editable_metadata_fields['source_code']['explicitly_set'] and enable_latex_compiler %>
cahrens committed
23
<% metadata_field_copy = copy.copy(editable_metadata_fields) %>
24 25 26 27
## Delete 'source_code' field (if it exists) so metadata editor view does not attempt to render it.
% if 'source_code' in editable_metadata_fields:
    ## source-edit.html needs access to the 'source_code' value, so delete from a copy.
    <% del metadata_field_copy['source_code'] %>
cahrens committed
28
% endif
29 30

% if showHighLevelSource:
31
    <div class="launch-latex-compiler">
32
      <a href="#hls-modal-${hlskey}" id="hls-trig-${hlskey}">${_("Launch Latex Source Compiler")}</a>
33
    </div>
34
    <%include file="source-edit.html" />
35
% endif
36

37
<div class="wrapper-comp-settings metadata_edit" id="settings-tab" data-metadata='${json.dumps(metadata_field_copy, cls=EdxJSONEncoder) | h}'/>