{% extends "projects/project_menu.html" %}
{% load i18n %}
{% load markup %}
{% load addons %}
{% load txcommontags %}
{% load statistics %}
{% load watches %}
{% load permissions %}


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

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

{% block breadcrumb %}{{ block.super }} &raquo; {{ project.name }}{% endblock %}

{% block content_main %}
{% get_permission "project_perm.maintain" for request.user and project as "is_maintainer" %}
  <div class="obj_bigdetails ui-tabs-panel">
  {% if project.private %}
  <span id="private_project_banner" class="ui-corner-all">
    {% trans "Private Project"%}
    <img style="vertical-align:top" src="{{ STATIC_URL }}images/icons/lock.png" title="Private Project">
  </span>
  {% endif %}
  <h2 class="name">{{ project.name }}</h2>

  <p class="description">{% firstof project.description|escape project.name|escape %}</p>

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

  {% if perms.projects.change_project or is_maintainer %}
  <div class="editlinks"><p><a class="i16 edit buttonized" href="{% url project_edit project_slug=project.slug %}">{% trans "Edit" %}</a></p></div>
  {% endif %}

  <div class="details separate">

  {% if project.homepage or project.tags %}
    <h4>{% blocktrans %}Details{% endblocktrans %}</h4>
  {% endif %}
  <table class="definition">
    {% if request.user.is_authenticated%}
      {% url notification.views.notices as notices_url %}
      {% if notices_url %}
   <tr>
      <th class="i16 watch">{% trans "Watch:" %}</th>
      <td>
        {% watch_toggle project %}
    </td>
      {% endif %}
    {% endif %}
    {% if project.homepage %}
    <tr>
      <th class="homepage i16">{% trans "Homepage:" %}</th>
      <td><a title="{% blocktrans with project.name as project_name %}Homepage for {{ project_name }}{% endblocktrans %}" href="{{ project.homepage }}" target="_blank" >{{ project.homepage }}</a></td>
    </tr>
    {% endif %}
    {% if project.bug_tracker %}
    <tr>
      <th class="bug i16">{% trans "Bug tracker:" %}</th>
      <td><a title="{% blocktrans with project.name as project_name %}Bug tracker for {{ project_name }}{% endblocktrans %}" href="{{ project.bug_tracker }}" target="_blank" >{{ project.bug_tracker }}</a></td>
    </tr>
    {% endif %}
    {% if project.tags %}
    <tr>
      <th class="i16 tag">{% trans "Tags:" %}</th>
      <td class="compact">
        {% for tag in project.tagsobj.all|slice:"0:6" %}<a class="tag" href="{% url project_tag_list tag=tag %}">{{ tag }}</a> {% endfor %}
      </td>
    </tr>
    {% endif %}
    {% with project.maintainers.all as maintainers %}
    {% if maintainers %}
    <tr>
      <th class="i16 maintainer">{% blocktrans count maintainers|length as counter %}Maintainer:{% plural %}Maintainers:{% endblocktrans %}</th>
      <td>
        {% for m in maintainers|slice:"0:6" %}
          {% if m.first_name and m.last_name %}
            {{ m.first_name }} {{ m.last_name }} ({{m.email|mungify:m.username}})
          {% else %}
            {{m.email|mungify:m.username}}{% endif %}{% if not forloop.last %},{% endif %}
        {% endfor %}
      </td>
    </tr>
    {% endif %}
    {% endwith %}

{% comment %}
    <tr>
      <th class="i16 link">{% trans "External links:" %}</th>
      <td><ul>
        <li>{% trans "Screenshots" %}</li>
        </ul>
      </td>
    </tr>
{% endcomment %}
  </table>
</div>

  {% hook "project.html" overview_top %}

{% include "projects/component_list.html" %}

{% include "projects/release_list.html" %}

</div>

<h3>{% trans 'History' %}</h3>
{% load tx_action_log %}
{% get_log 5 as action_log for_object project %}
{% if not action_log %}

<p>{% trans 'None available' %}</p>

{% else %}

<ul class="actionlist simple">
{% for entry in action_log %}
<li class="i16 actionlog">
    {{ entry.message|safe }} by {{ entry.user }} {{ entry.action_time|timesince }} ago.
</li>
{% endfor %}
</ul>
{% hook "project.html" overview %}

{% endif %}

{% get_top_translators 5 project %}
{% include "projects/project_top_translators.html" %}

{% endblock %}

{% block content_footer %}
{% get_permission "project_perm.maintain" for request.user and project as "is_maintainer" %}
  <div id="content_footer_center">
    {% if perms.projects.delete_project or is_maintainer %}
    <div class="deletelink">
      <a class="i16 delete buttonized" href="{% url project_delete project_slug=project.slug %}">{% trans "Delete project" %}</a>
    </div>
    {% endif %}
  </div>
{% endblock %}
