{% load i18n baseurl progressbar %}
{% if 'name' in table.fields %}
<td class="stats-name"{% if item.description %} title="{{ item.description|striptags }}"{% endif %}>
  {% if item.href %}<a href="{{ item.href|l }}">{% endif %}
    {% if item.icon %}<i class="icon-{{ item.icon }}"></i>{% endif %}
    <span>{{ item.title }}</span>
  {% if item.href %}</a>{% endif %}
  {% if item.stats.errors %}
  <i class="icon-error"></i>
  {% endif %}
</td>
{% endif %}
{% if 'language' in table.fields %}
<td class="language">
  <a href="{% filter l %}/{{ item.code }}/{% endfilter %}">{{ item.name }}</a>
</td>
{% endif %}
{% if 'project' in table.fields %}
<td class="project">
  <a href="{% filter l %}/projects/{{ item.code }}/{% endfilter %}"
    title="{{ item.description }}">{{ item.name }}</a>
</td>
{% endif %}
{% if 'priority' in table.fields %}
<td class="stats-number">
  <span class="muted">{{ item.priority }}</span>
</td>
{% endif %}
{% if item.stats %}
{% if 'progress' in table.fields %}
<td class="stats-graph">
  <div class="sortkey">{{ item.stats.translated.percentage }}</div>
  {% if table.proportional %}
  {% progressbar item.stats stats.total.words %}
  {% else %}
  {% progressbar item.stats %}
  {% endif %}
</td>
{% endif %}
{% if 'total' in table.fields %}
<td class="stats-number">
  {% if item.total_words > 0 %}
  {% if item.href_all %}
  <a href="{{ item.href_all }}">{{ item.total_words }}</a>
  {% else %}
  <span class="muted">{{ item.total_words }}</span>
  {% endif %}
  {% else %}
  <span class="muted">0</span>
  {% endif %}
</td>
{% endif %}
{% if 'need-translation' in table.fields %}
<td class="stats-number">
  {% if item.todo_words > 0 %}
  {% if item.href_todo %}
  <a href="{{ item.href_todo }}" title="{{ item.todo_tooltip }}">{{ item.todo_words }}</a>
  {% else %}
  <span class="muted">{{ item.todo_words }}</span>
  {% endif %}
  {% else %}
  <span class="muted">0</span>
  {% endif %}
</td>
{% endif %}
{% if 'suggestions' in table.fields %}
<td class="stats-number">
  {% if item.stats.suggestions > 0 %}
  {% if item.href_sugg %}
  <a href="{{ item.href_sugg }}">{{ item.stats.suggestions }}</a>
  {% else %}
  <span class="muted">{{ item.stats.suggestions }}</span>
  {% endif %}
  {% endif %}
</td>
{% endif %}
{% if 'activity' in table.fields %}
<td>{{ item.lastactivity }}</td>
{% endif %}
{% else %}
{% for i in table.fields %}{% if not forloop.last %}<td></td>{% endif %}{% endfor %}
{% endif %}
{% if 'tags' in table.fields %}
<td id="js-tag-tp-{{ item.pk }}-hidden" class="hide tags-cell" colspan="{{ table.headings|length|add:'-1' }}">
  {% if user.is_superuser or request.permissions.administrate %}
  <a href="#js-add-tag-dialog" class="js-project-add-tag-popup tags-aside tags-add"
    title="{% trans "Add a tag" %}">
    <i class="icon-tag-add"></i>
  </a>
  {% endif %}
  <ul class="tag-list">
    {% include "project/xhr_tags_list.html" with tp_tags=item.tags project=item.project language=item.code %}
  </ul>
</td>
{% endif %}
