{% 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>
<script id="js-editor-msg" type="text/template">
{% include_raw "editor/msg.html" %}
</script>
{% assets "js_editor" %}
<script type="text/javascript" src="{{ ASSET_URL }}"></script>
{% endassets %}
<script type="text/javascript">
$(function() {
  var options = {
    tmUrl: '{{ AMAGAMA_URL }}',
    pootlePath: '{{ pootle_path }}',
    vFolder: '{{ current_vfolder_pk }}',
    ctxPath: '{{ ctx_path }}',
    resourcePath: '{{ resource_path }}',
    chunkSize: {{ request.profile.get_unit_rows }},
    isAdmin: {{ is_admin|yesno:"true,false" }},
    isAnonymous: {{ request.profile.is_anonymous|yesno:"true,false" }},
    userId: {{ request.profile.id }},
  };
  {% if cansuggest or cantranslate %}
  options.mt = [
    {% for provider, apikey in POOTLE_MT_BACKENDS %}
    { name: '{{ provider }}', key: '{{ apikey }}' },
    {% endfor %}
  ];
  {% endif %}
  PTL.editor.init(options);
});
</script>
