{% extends "base.html" %}
{% load compress %}
{% load i18n %}
{% load crispy_forms_tags %}
{% load translations %}
{% load icons %}
{% load static %}
{% load permissions %}

{% block extra_script %}
{% compress js %}
<script defer data-cfasync="false" src="{% static 'editor/base.js' %}{{ cache_param }}"></script>
<script defer data-cfasync="false" src="{% static 'editor/zen.js' %}{{ cache_param }}"></script>
{% endcompress %}
{% endblock %}

{% block breadcrumbs %}
<li><a href="{{ project.get_absolute_url }}">{{ object.component.project }}</a></li>
{% if object.component.slug != "-" %}
{% include "snippets/component-breadcrumb.html" with object=object.component %}
{% endif %}
{% include "snippets/translation-breadcrumb.html" %}
<li><a href="{% url 'browse' project=project.slug component=object.component.slug lang=object.language.code %}">{% trans "Browse" %}</a></li>
<a class="pull-right flip" href="{{ object.get_widgets_url }}">
<img src="{% url 'widget-image' project=project.slug component=object.component.slug widget='svg' color='badge' lang=object.language.code extension='svg' %}?native=1" />
</a>
{% endblock %}

{% block content %}

{% if object.component.slug == "-" %}
  {% for component in project.component_set.all %}
    {% include "snippets/component/state.html" with object=component %}
  {% endfor %}
{% else %}
  {% include "snippets/component/state.html" with object=object.component %}
{% endif %}

{% perm 'unit.add' object as user_can_add_unit %}
{% if user_can_add_unit %}
  <a class="btn btn-link green pull-right flip" href="{{ object.get_absolute_url }}#new">{% icon "plus-circle.svg" %} {{ object.component.get_add_label }}</a>
{% endif %}

<form method="GET" class="result-page-form">
  {% crispy search_form  %}
</form>

{% if not units %}
  <em>{% trans "No strings found!" %}</em>
{% else %}
  {% include "snippets/embed-units.html" with translation=object include_search=True component=object.component %}
{% endif %}

{% endblock %}
