{% extends "front/front_base.html" %}
{% load i18n %}
{% load thumbnail %}
{% load front_tags %}
{% load absstatic %}

{% block title %}Lignes de temps : groupe "{{group.name}}"{% endblock %}

{% block css_import %}
{{block.super}}
<link rel="stylesheet" href='{% absstatic "ldt/css/front_group.css" %}' type="text/css"/>
{% endblock %}

{% block js_declaration %}
{{block.super}}
<script type="text/javascript">
    $(document).ready(function () {
        $("#home_tag_cloud").toggle(false);
        $("#hide_tag_cloud").toggle(false);
        $("#show_tag_cloud").toggle(true);
        $("#tag_cloud_link").click(function(){
            $("#home_tag_cloud").slideToggle("fast");
            $("#hide_tag_cloud").toggle();
            $("#show_tag_cloud").toggle();         
        });
    });
</script> 
{% endblock %}

{% block body %}
{{block.super}}
<ul class="floatlist" id="medias_groupe">
    <li class="li_h2">
        <h2><a href="?">{% trans 'Projects shared by the group' %}&nbsp;{{group.name}}</a>
        <span class="tag_link"><a href="#" id="tag_cloud_link" title="{% trans 'Filter' %}"><img id="hide_tag_cloud" src='{% absstatic "ldt/img/little_minus_pink.png" %}' alt="{% trans 'Filter' %}" /><img id="show_tag_cloud" src='{% absstatic "ldt/img/little_plus_pink.png" %}' alt="{% trans 'Filter' %}" />&nbsp;{% trans 'Filter' %}</a></span></h2>
    </li>
    <li class="li_h2" id="home_tag_cloud">
      <form id="media_search" method="GET" action="">
        {% trans 'Search in the projects title' %} : 
        <input id="input_title" type="text" name="title"/><input id="search_title" type="submit" value=""/>
      </form>
    </li>
      <!-- Pagination -->
        <li id="result_pagination" class="li_h2">
            <p>
            {% if results.has_previous %}
                <a class="blue under" href="?page={{ results.previous_page_number }}{% if project_title %}&title={{project_title}}{% endif %}" title="{% trans 'previous' %}">{% trans "previous" %}</a>
            {% endif %}
            {% if results.paginator.num_pages > 1 %}
            <span class="current">
                {% for i in results.paginator.num_pages|get_range %}
                <span class="current">
                    {% if i|add:'1' == results.number %}
                    <span class="pink">{{i|add:'1'}}</span>
                    {% else %}
                    <a class="blue under" href="?page={{i|add:'1'}}{% if project_title %}&title={{project_title}}{% endif %}">{{i|add:'1'}}</a>
                    {% endif %}
                    {% if i|add:'1' < results.paginator.num_pages and 1 < results.paginator.num_pages %}
                    {% endif %}
                </span>
                {% endfor %}
            </span>
            {% endif %}
            {% if results.has_next %}
                <a class="blue under" href="?page={{ results.next_page_number }}{% if project_title %}&title={{project_title}}{% endif %}" title="{% trans 'next' %}">{% trans "next" %}</a>
            {% endif %}
            {% if results.paginator.num_pages > 1 %}
                . <a class="blue under" href="?page=x{% if project_title %}&title={{project_title}}{% endif %}"">({% trans 'All' %})</a>
            {% endif %}
            </p>
        </li>
    {% for p in results.object_list %}
    <li class="li_media">
      {% with c=p.contents.all|first %}
        <a href="{% url ldt.ldt_utils.views.front.annot_content c.iri_id p.ldt_id %}">{% thumbnail p.image "134x75" format="PNG" crop="center" as im %}<img src="{{ im.url }}" class="img_media" width="{{ im.width }}" height="{{ im.height }}" alt="{% trans 'open this project' %}" title="{% trans 'open this project' %}">{% endthumbnail %}</a>
        <p><a href="{% url ldt.ldt_utils.views.front.annot_content c.iri_id p.ldt_id %}" title="{% trans 'open this project' %}"><b>{% if p.title|length > 69 %}{{p.title|slice:":69"}}...{% else %}{{p.title}}{% endif %}</b></a></p>
        <p class="font_11">{% trans 'by' %} {{ p.owner }}</p>
      {% endwith %}
    </li>
    {% endfor %}
    <li class="li_h2">
        <h2><a href="{% url ldt.ldt_utils.views.front.group_list %}">&rarr; {% trans 'Back to the group list' %}</a></h2>
    </li>
</ul>

{% comment %}
<!-- Medias annotated by the group -->
<ul class="floatlist" id="medias_groupe">
    <li class="li_h2">
        <h2>{% trans 'Medias annotated by the group' %}&nbsp;{{group.name}}</h2>
    </li>
    {% for content in content_list %}
    <li class="li_media">
        <a href="{% url ldt.ldt_utils.views.front.annot_content content.iri_id %}">{% thumbnail content.image "134x75" format="PNG" crop="center" as im %}<img src="{{ im.url }}" class="img_media" width="{{ im.width }}" height="{{ im.height }}" alt="{% trans 'open this media' %}" title="{% trans 'open this media' %}">{% endthumbnail %}</a>
        <div class="bulle_annot" title="{% blocktrans count nb=content.nb_annotations %}{{nb}} annotation on this media{% plural %}{{nb}} annotations on this media{% endblocktrans %}">{{content.nb_annotations}}</div>
        <p><a href="{% url ldt.ldt_utils.views.front.annot_content content.iri_id %}" title="{% trans 'open this media' %}"><b>{% if content.title|length > 69 %}{{content.title|slice:":69"}}...{% else %}{{content.title}}{% endif %}</b></a></p>
        <p class="font_11">{% trans 'by' %} IRI | {{content.duration|str_duration:"h"}}</p>
    </li>
    {% endfor %}
</ul>
{% endcomment %}

<!-- Right column -->
<div id="groupe_droite">
  <!-- About the group -->
	<div class="li_h2">
	    <h2>{% trans 'About the group' %}</h2>
	</div>
	<p class="bigmargin">
	   {{group.get_profile.description|safe}}
	</p>
	{% thumbnail group.get_profile.image "54x40" format="PNG" crop="center" as im %}<img src="{{ im.url }}" class="img_media" width="{{ im.width }}" height="{{ im.height }}" alt="{{content.title}}" title="{{group.name}}" alt="{{group.name}}">{% endthumbnail %}
	<p class="clear">&nbsp;</p>
  <!-- MEMBERS -->      
	<div class="li_h2">
	    <h2>{% trans 'Members' %} <span class="pink">({{users|length}})</span></h2>
	</div>
	<ul class="floatlist" id="membres_groupes">
	    {% for user in users %}
	    <li class="li_membre_groupe">
	      {% thumbnail user.get_profile.image "36x36" format="PNG" crop="center" as im %}<img src="{{ im.url }}" class="img_media" width="{{ im.width }}" height="{{ im.height }}" title="{{user.username}}" alt="{{user.username}}">{% endthumbnail %}
	      <p><b>{{user.username}}</b></p>
	      <p class="font_11">{% trans 'active since' %} {{user.date_joined|date:"Y/m/d"}}</p>
	    </li>
	    {% endfor %}
	</ul>
</div>
{% endblock %}

