{% load assets store_tags %}
<script id="view_unit" type="text/template">
{% include_raw "unit/xhr-view.html" %}
</script>
<script id="tm_suggestions" type="text/template">
{% include_raw "unit/xhr-tm.html" %}
</script>
<script id="editCtx" type="text/template">
{% include_raw "unit/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 }}'
  };
  {% 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>
