{% load static %}
{% load i18n %}
{% load analytics %}
{% load thumbnail %}
{% load front_tags %}
<!DOCTYPE html>
<html>
<head>
{% block head %}
    <meta charset="utf-8">
    <title>Metadata Composer {{branding}} - Back office &raquo; {% block title %}{% trans "Home" %}{% endblock %}</title>
    <!--[if lt IE 9]>
        <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    {% block css_import %}
    <link rel="stylesheet" href="{% static 'metadatacomposer/lib/bootstrap/css/bootstrap.min.css' %}" />
    <link rel="stylesheet" href="{% static 'metadatacomposer/css/style.css' %}" />
    {% endblock %}
    {% block css_page %}
    {% endblock %}
    {% block css_declaration %}
    {% endblock %}
    {% include top_header_css %}
{% endblock %}
</head>
<body>
{% block body %}
  {% block wrapper %}
    <div class="wrap">
        <header>
            <div class="container">
                <div class="row">
                    <div class="span3"><h1><a class="clearfix" href="{% url 'composer_home' branding=branding %}">
                        {% include top_header_partial %}
                    </a></h1></div>
                    <div class="span9">
                        <ul class="breadcrumb nav-bar">
                        <li><a href="{% url 'composer_project_list' branding=branding %}"><i class="icon-file"></i> Projets</a> <span class="divider">/</span></li>
                        <li><a href="{% url 'composer_resource_list' branding=branding %}"><i class="icon-folder-close-alt"></i>Ressources</a></li>
                        <li class="user-login-logout">
                        {% if user.is_authenticated %}
			            <a href="{% url 'composer_project_list' branding=branding %}">{{user.username}}</a>
			            |&nbsp;<a href="{% url 'ldt.user.views.logout_view' %}" title="{% trans "Log out" %}">{% trans "Log out" %}</a>
			            {% else %}
			            <a href="{% url 'auth_login' %}?next={% url 'composer_home' branding=branding %}">{% trans "Log in" %}</a>
			            {% endif %}
			            </li>
                        </ul>
                    </div>
                </div>
            </div>
        </header>
        <section>
          {% block containers %}
            <!-- block containers -->
            <article class="container">
                <div class="row article-title">
                    <h3 class="span8"><i class="icon-file"></i> Derniers projets</h3>
                    <div class="span4 wrap-btn-add">
                        <a data-type-media="video" data-title="Ajouter un projet" class="btn btn-success open-modal" 
                            href="{% url 'composer_modal_content_library' branding=branding %}?mode=create" data-hide-add-new>
                            Ajouter un projet <i class="icon-plus-sign"></i></a>
                    </div>
                </div>
                <div class="row">
                  {% for p in projects %}
                    <div class="span2">
                        <div class="vignette-projet">
	                        <a class="btn-editer" title="éditer le projet" href="{% url 'composer_edit' branding=branding ldt_id=p.ldt_id %}"><i class="icon-pencil"></i></a>
	                        <a class="btn-apercu" title="voir le projet" href="{% url 'composer_preview_player' branding=branding ldt_id=p.ldt_id %}"><i class="icon-eye-open"></i></a>
	                        {% thumbnail p.image "140x140" crop="center" format="PNG" as im %}<img src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}" />{% empty %}<img src="{% static 'metadatacomposer/img/140x140.gif' %}" width="140px" height="140px" />{% endthumbnail %}
	                    </div>
                        <h4><a href="#">{{ p.title }}</a></h4>
                    </div>
                  {% endfor %}
                </div>
            </article>
            <article class="container">
                <div class="row article-title">
                    <h3 class="span8"><i class="icon-picture"></i> Dernières images</h3>
                    <div class="span4 wrap-btn-add">
                        <a data-type-media="image" data-title="Ajouter une image" class="btn btn-success open-modal" 
                         href="{% url 'composer_modal_image' branding=branding %}" data-hide-bibliotheque="">
                         Ajouter une image <i class="icon-plus-sign"></i></a>
                    </div>
                </div>
                <div class="row">
                  {% for i in images %}
                    <div class="span2">
                        <a href="{% url 'composer_image' branding=branding image_pk=i.pk %}?maxwidth=530&maxheight=500&imgtag=true" data-type-media="image" data-title="{{ i.title }}" class="open-modal">
                            {% thumbnail i.image_file "140x140" crop="center" format="PNG" as im %}<img src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}" />{% empty %}<img src="{% static 'metadatacomposer/img/140x140.gif' %}" width="140px" height="140px" />{% endthumbnail %}
                        <h4>{{ i.title }}</h4></a>
                    </div>
                  {% endfor %}
                </div>
            </article>
            <article class="container">
                <div class="row article-title">
                    <h3 class="span8"><i class="icon-film"></i> Dernières vidéos</h3>
                    <div class="span4 wrap-btn-add">
                        <a data-type-media="video" data-title="Ajouter une vidéo" class="btn btn-success open-modal" 
                         href="{% url 'composer_modal_content' branding=branding %}" data-hide-bibliotheque="">
                         Ajouter une vidéo <i class="icon-plus-sign"></i></a>
                    </div>
                </div>
                <div class="row">
                  {% for c in contents %}
                    <div class="span2">
                        <a href="{% url 'embed_iframe_v2' %}?content_id={{ c.iri_id }}" data-type-media="video" data-title="{{ c.title }}" class="open-modal" data-hide-add-new data-iframe>
                            {% thumbnail c.image "140x140" crop="center" format="PNG" as im %}<img src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}" />{% empty %}<img src="{% static 'metadatacomposer/img/140x140.gif' %}" width="140px" height="140px" />{% endthumbnail %}
                        <h4>{{ c.title }}</h4></a>
                    </div>
                  {% endfor %}
                </div>
            </article>
            <!-- endblock containers -->
          {% endblock %}
        </section>
        <footer></footer>
    </div><!-- wrap -->
  {% endblock %}
  {% block modal_divs %}
    <div id="modal-template" class="modal hide fade popup" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
            <h3></h3>
        </div>
        <div class="modal-body"></div>
    </div>
  {% endblock %}
  {% block js_common %}
    <script src="{% static 'metadatacomposer/lib/jquery-1.9.1.min.js' %}"></script>
    <script src="{% static 'metadatacomposer/lib/bootstrap/js/bootstrap.min.js' %}"></script>
    <script src="{% static 'metadatacomposer/lib/spin/jquery.spin-1.0.2.js' %}"></script>
    <script src="{% static 'metadatacomposer/js/common.js' %}"></script>
  {% endblock %}
  {% block js_page %}
    <script src="{% static 'metadatacomposer/js/home.js' %}"></script>
  {% endblock %}
{% endblock %}
{% analytics %}
</body>
</html>
