{% extends "project_base.html" %}
{% load i18n baseurl cleanhtml assets common_tags search %}
{% load url from future %}
{% get_current_language as LANGUAGE_CODE %}

{% block title %}{{ project.name }} | {{ block.super }}{% endblock %}

{% block body_id %}projectoverview{% endblock %}

{% block search %}{% render_search %}{% endblock %}

{% block content %}
<div class="module first">
  <div class="hd">
    <h2>
      {{ project.summary }}
      <a href="" id="js-toggle-tags" class="hide tags-aside tags-toggle">
        <i class="icon-tag"></i>
        <span id="js-toggle-tags-text">{% trans "Show tags" %}</span>
      </a>
      <a href="" id="js-toggle-filter" class="hide filter-aside filter-toggle"
        title="{% trans "Show filtering" %}">
        <i class="icon-filter"></i>
      </a>
    </h2>
  </div>

  <div class="tags-bd">
    <form action="" method="post" class="js-filter tags-filter-form"
      enctype="multipart/form-data">
      {% csrf_token %}
      <input type="hidden" id="js-tag-filtering" class="select2-multiple"
        data-placeholder="{% trans "Filter using one or more tags" %}"
        data-ajaxurl="{% url 'pootle-project-ajax-list-tags' project.code %}">
      </input>
      <input type="submit" id="js-filter-form-button"
        value="{% trans "Filter" context "verb" %}"
        title="{% trans "Filter using the selected tags" %}" />
    </form>
  </div>

  <div class="bd">
    {% display_table table %}
  </div>

  {% include "translation_summary_legend.html" %}
</div>

<div class="module">
  {% if project.description or can_edit %}
  <div class="hd">
    <h2>{% trans "Description" %}</h2>
  </div>

  <div id="overview-description" class="bd">
    <div id="overview-description-project"
      class="markup-body{% if can_edit %} js-ctx-meta-desc{% endif %}">
    {% if project.description %}
      {{ project.description }}
    {% else %}
      <p class="placeholder muted">{% trans "No description set." %}</p>
    {% endif %}
    {% if can_edit %}
      {% include "admin/edit_links.html" %}
    </div>
    <div class="settings-container js-edit-ctx-meta-desc" style="display:none;">
      {% include "admin/general_settings_form.html" with form_action="edit_settings.html" %}
    {% endif %}
    </div>
  </div>
  {% endif %}
</div>

{% if user.is_superuser or request.permissions.administrate %}
<div id="js-add-tag-dialog" class="form popup-inline mfp-hide" lang="{{ LANGUAGE_CODE }}">
  <h2>{% trans "Add tag" %}</h2>
  {% include "common/xhr_add_tag_form.html" %}
</div>
{% endif %}
{% endblock content %}

{% block postcontent %}
{% include "top_contributers_table.html" %}
{% endblock postcontent %}

{% block scripts_extra %}
<script type="text/javascript">
$(function() {
  PTL.search.init();

  $("td.stats-name").filter(":not([dir])").bidi();
});
</script>
{% if user.is_superuser or request.permissions.administrate %}
{% assets "js_admin" %}
<script type="text/javascript" src="{{ ASSET_URL }}"></script>
{% endassets %}
{% endif %}
{% endblock %}
