{% load static %}
{% load i18n %}
{#% load analytics %#}
<!DOCTYPE html>
<html lang="fr">
    {% block head %}
    <head>
        <meta charset="utf-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
        <title>TagItAll by eGonomy &raquo; {% block title %}Base{% endblock %}</title>
        {% block css_declaration %}{% endblock %}
	    {% block css_import %}
        <link rel="stylesheet" href="{% static 'egonomy/css/egonomy.css' %}" />
	    {% endblock %}
	    {% block css_page %}{% endblock %}
        {% block js_import %}
        <script type="text/javascript" src="{% static 'egonomy/lib/jquery.min.js' %}"></script>
        {% endblock %}
        {% block js_inline %}
        <script type="text/javascript">
            $(function() {
                $(".search-type").change(function() {
                    $(".search-form").attr("action", $(this).val());
                    if ($(".search-field").val()) {
                        $(".search-form").submit();
                    }
                });
            });
        </script>
        {% endblock %}
    </head>
    {% endblock %}
    <body>
        <div class="header-wrap fullwidth">
            <header>
                <h1 class="column column-third"><a href="{% url 'home' %}">TagItAll {% trans "by" %} eGonomy</a></h1>
                <form class="search-form column column-third" action="{% if search_fragment %}{% url 'all_fragments' %}{% else %}{% url 'all_pictures' %}{% endif %}" method="GET">
                    <input class="search-field" type="search" placeholder="{% trans 'Search' %}" id="id_search" name="search"/>
                    <select class="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>
                    <input type="hidden" value="all" name="field">
                </form>
                <nav class="column column-third">
                  {% if user.is_authenticated %}
		            <a href="{% url 'user_fragments' username=user %}">{{ user.username }}</a> : <a href="{% url 'logout' %}?next={% url 'home' %}">{% trans "Log out" %}</a>
		          {% else %}
		            <a href="{% url 'login' %}">{% trans "Log in" %}</a>
		          {% endif %}
                </nav>
            </header>
        </div>
        <div class="main-wrap fullwidth">
            <div class="main">
                {% block content %}
                {% endblock %}
                <footer class="fullwidth">
                    <ul class="footer-list">
                        <li>&copy; IRI 2013</li>
                        <li>v{{ VERSION }}</li>
                    </ul>
                </footer>
            </div>
        </div>
    {#% analytics %#}
    </body>
</html>
