{% load assets store_tags %}
<script id="view_unit" type="text/template">
{% include_raw "editor/units/xhr_view.html" %}
</script>
<script id="tm_suggestions" type="text/template">
{% include_raw "editor/units/xhr_tm.html" %}
</script>
<script id="editCtx" type="text/template">
{% include_raw "editor/units/xhr_edit_ctx.html" %}
</script>
{% assets "js_editor" %}
<script type="text/javascript" src="{{ ASSET_URL }}"></script>
{% endassets %}
<script type="text/javascript">
$(document).magnificPopup({
  type: 'image',
  delegate: '.js-dev-img',
  gallery: {
    enabled: true
  }
});
$(function() {
  var options = {
    tmUrl: '{{ AMAGAMA_URL }}',
    pootlePath: '{{ pootle_path }}',
    ctxPath: '{{ ctx_path }}',
    resourcePath: '{{ resource_path }}',
    chunkSize: {{ unit_rows }},
    isAdmin: {{ is_admin|yesno:"true,false" }}
  };
  {% if cansuggest or cantranslate %}
  options.mt = [];
    {% for backend, apikey in MT_BACKENDS %}
    options.mt.push({name: "{{ backend|lower }}", key: "{{ apikey }}"});
    {% endfor %}
  {% endif %}
  options.lookup = [];
  {% for backend in LOOKUP_BACKENDS %}
    options.lookup.push("{{ backend|lower }}");
  {% endfor %}
  PTL.editor.init(options);
});
</script>
