{% load static %}
{% load i18n %}
<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
{% block head %}
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="description" content="eGonomy">
    <title>TagItAll by eGonomy &raquo; {% block title %}Base{% endblock %}</title>
    {% block css_declaration %}{% endblock %}
    {% block css_import %}
    <link rel="stylesheet" href="{% static 'egonomy/css/reset.css' %}" />
    <link rel="stylesheet" href="{% static 'egonomy/css/fonts.css' %}" />
    <link rel="stylesheet" href="{% static 'egonomy/css/style.css' %}" />
    {% endblock %}
    {% block css_page %}{% endblock %}
</head>
{% endblock %}
<body>
    <div class="popin-wrap">
      {% if current_user_collection_list %}
        <div id="add-to-collection" class="popin popin-new-collection box-shadow">
            <header>
                <h2>{% trans "Add to the collection" %}</h2>
                <a href="#" class="close-popin"></a>
            </header>
            <section>
                <form action="{% url 'add_item' %}" method="POST">
                    <p>
                        <label for="collection-name">{% trans "Add to" %} :</label>
                        <label class="styled-select">
                            <select name="collection-pk">
                              {% for c in current_user_collection_list %}
                                <option value="{{ c.pk }}">{{ c.title }}</option>
                              {% endfor %}
                            </select>
                        </label>
                    </p>
                    <p>
                        <label class="block" for="item-description">{% trans "Image comment" %} :</label>
                        <textarea name="item-description" id="item-description"></textarea>
                    </p>
                    <div class="buttons">
                        <a href="#" class="btn close-popin">{% trans "Cancel" %}</a>
                        <input class="btn" type="submit" value="{% trans 'Submit' %}">
                    </div>
                    <input class="item-type" name="item-type" type="hidden" value="">
                    <input class="item-id" name="item-id" type="hidden" value="">{% csrf_token %}
                </form>
            </section>
        </div>
      {% endif %}
      {% block popins %}{% endblock %}
    </div>
    <div class="wrap">
        <header class="clearfix">
            <h1><a href="{% url 'home' %}">egonomy</a></h1>
            <div class="col-right">
                <ul class="head-login clearfix">
                    <li>
                        <form id="search-form" action="{% if search_fragment %}{% url 'all_fragments' %}{% else %}{% url 'all_pictures' %}{% endif %}" method="GET">
                            <p>
			                    <input id="search-field" type="text" placeholder="{% trans 'Search' %}" name="search"/>
			                    <label class="styled-select">
				                    <select id="search-type">
				                        <option value="{% url 'all_pictures' %}"{% if not search_fragment %} selected{% endif %}>Images</option>
				                        <option value="{% url 'all_fragments' %}"{% if search_fragment %} selected{% endif %}>Fragments</option>
				                    </select>
			                    </label>
			                    <input type="hidden" value="all" name="field">
		                    </p>
		                </form>
                    </li>
                  {% if user.is_authenticated %}
                    <li class="hello-user">Bonjour <a href="{% url 'user_fragments' username=user %}">{{ user.username }}</a>
                    <li><span class="dot-6"></span></li>
                    <li><a href="{% url 'logout' %}?next={% url 'home' %}">{% trans "Log out" %}</a></li>
                  {% else %}
                    <li class="hello-user"><a href="{% url 'login' %}">{% trans "Log in" %}</a></li>
                  {% endif %}
                </ul>
                <nav>
                    <ul class="nav clearfix">
                        <li><a href="{% url 'all_pictures' %}">explorer</a></li>
                        <li><span class="dot-10"></span></li>
                        <li><a href="{% url 'all_collections' %}">collectionner</a></li>
                        <!--li><span class="dot-10"></span></li>
                        <li><a href="#">créer</a></li>
                        <li><span class="dot-10"></span></li>
                        <li><a href="">mon profil</a></li-->
                    </ul>
                  {% if user.is_authenticated %}
                    <ul class="sub-nav clearfix">
                        <li><a href="{% url 'user_collections' username=user %}" {% if user_collections %}class="active"{% endif %}>mes collections</a></li>
                        <li><span class="dot-6"></span></li>
                        <li><a href="{% url 'user_fragments' username=user %}" {% if user_fragments %}class="active"{% endif %}>mes fragments</a></li>
                        <!--li><span class="dot-6"></span></li>
                        <li><a href="#">mon profil</a></li-->
                    </ul>
                  {% endif %}
                </nav>
            </div>
        </header>
        <section>
        {% block content %}
        {% endblock %}
        </section>
        <footer class="clearfix">
            <!--h6>EGONOMY est un projet de l’IRI et de la réunion des Musées Nationaux</h6-->
            <p>&copy; IRI 2013 - v{{ VERSION }}</p>
        </footer>
        {% block js_common %}
        <script type="text/javascript" src="{% static 'egonomy/lib/jquery.min.js' %}"></script>
	    <script type="text/javascript" src="{% static 'egonomy/js/masonry.min.js' %}"></script>
	    <script type="text/javascript" src="{% static 'egonomy/js/main.js' %}"></script>
	    {% endblock %}
        <script type="text/javascript">
        $(function() {
            $("#search-type").change(function() {
                $("#search-form").attr("action", $(this).val());
                if ($("#search-field").val()) {
                    $("#search-form").submit();
                }
            });
        });
        </script>
	    {% block js_page %}
	    {% endblock %}
    </body>
</html>