{% extends "projects/project_detail_childs.html" %}
{% load statistics %}
{% load markup %}
{% load i18n %}
{% load truncate %}
{% load permissions %}
{% load txpermissions %}

{% block extra_head %}
  <link rel="alternate" type="application/rss+xml" title="RSS" href="{% url release_feed release.project.slug release.slug %}" />
  <script type="text/javascript" src="{{ STATIC_URL }}js/tablesorted.js"></script>
  <link media="screen" href="{{ STATIC_URL }}css/tablesorter.css" type="text/css" rel="stylesheet" />
  {% include "translations/stats_table_filter_header.html" %}

  <script type="text/javascript">
    $(function(){
        // Toogle to components list
        $("#component-list-toggler").click(function () {
            $("#component-list").slideToggle("slow");
        });
    });
  </script>
{% endblock %}

{% block body_class %}{{ block.super }} release_detail{% endblock %}

{% block title %}{{ block.super }} | Release '{{ release.name }}'{% endblock %}

{% block breadcrumb %}{{ block.super }} &raquo; Release '{{ release.name }}'{% endblock %}

{% block content_sec %}
  <a class="simlink" href="{% url release_feed release.project.slug release.slug %}" title="Statistics feed for this release"><img border="0" src="{{ STATIC_URL }}/images/icons/feed.png" /></a>
{% endblock %}

{% block content_main %}
  <div class="obj_bigdetails">
  <h2 class="pagetitle">{{ release.project.name }}</h2>
  <h3 class="pagesubtitle">Release '{{ release }}'</h3>
  
  {% if release.description %}<p class="description">{{ release.description }}</p>{% endif %}

  {% with release.long_description_html as long_desc %}
  {% if long_desc %}
  <div class="long_description">
    {{ long_desc|truncatewords:"100"|safe }}
  </div>
  {% endif %}
  {% endwith %}

  {% get_permission "project_perm.maintain" for request.user and release.project as "is_maintainer" %}
  {% if perms.projects.add_release or is_maintainer %}
    <div class="editlinks">
      <p><a class="i16 edit buttonized" href="{% url release_edit project_slug=release.project.slug release_slug=release.slug %}">{% trans "Edit" %}</a></p>
    </div>
  {% endif %}

  <div class="details">

  {% if release.homepage or release.release_date %}
  <h4>{% blocktrans %}Details{% endblocktrans %}</h4>
  {% endif %}
  <table class="definition">
    <tr {% if not release.homepage %}class="empty {% if not request.user.is_authenticated %}nodisplay{% endif %}"{% endif %}>
      <th class="homepage i16">{% trans "Homepage:" %}</th>
      <td><a href="{{ release.homepage }}">{{ release.homepage }}</a></td>
    </tr>
    <tr class="separator"></tr>
    <tr class="{% if not release.release_date %}empty {% if not request.user.is_authenticated %}nodisplay{% endif %}{% endif %}">
      <th class="release_date i16">{% trans "Release date:" %}</th>
      <td>{{ release.release_date|date:"D d M Y" }}</td>
    </tr>
    <tr {% if not release.stringfreeze_date %}class="empty {% if not request.user.is_authenticated %}nodisplay{% endif %}"{% endif %}>
      <th class="freeze i16">{% trans "String freeze:" %}</th>
      <td>{{ release.stringfreeze_date|date:"D d M Y" }}</td>
    </tr>
    <tr {% if not release.develfreeze_date %}class="empty {% if not request.user.is_authenticated %}nodisplay{% endif %}"{% endif %}>
      <th class="freeze i16">{% trans "Devel freeze:" %}</th>
      <td>{{ release.develfreeze_date|date:"D d M Y" }}</td>
    </tr>
    <tr class="separator"></tr>
    <tr>
      <th class="component i16">{% trans "Components:" %}</th>
      <td>
        {% with release.components.all|dictsort:"full_name" as component_list %}
        {% with component_list|length as components_number %}
        <span id="component-list-toggler" class="buttonized_simple" title="{% trans "Click here to show or hide the component list" %}">
        {% blocktrans %}This release has {{ components_number }} components.{% endblocktrans %}
        </span>
        <ul id="component-list" class="simple links" style="display:none;">
          {% for comp in component_list %}
            <li><a title="{% firstof comp.description|escape comp.name|escape %}" href="{{ comp.get_absolute_url }}">{{ comp.full_name }}</a></li>
          {% endfor %}
        </ul>
        {% endwith %}
        {% endwith %}
      </td>
    </tr>
  </table>
</div>

<div id="projects" class="projects">

<h3>{% trans "Translation statistics" %}</h3>

{% include "translations/stats_table_filter_box.html" %}

{% release_stats_table release %}

{% if not pofile_list %}
<p>{% trans "No translations added for this release. :-(" %}</p>
{% endif %}

</div>
</div>
{% endblock %}{# body_main #}

{% block content_footer %}
  <div id="content_footer_center">
    {% if request.user.is_authenticated and perms.projects.delete_release %}
    <div class="deletelink">
      <a class="i16 delete buttonized" href="{% url release_delete release.project.slug release.slug %}">{% trans "Delete release" %}</a>
    </div>
    {% endif %}
  </div>
{% endblock %}
