{% extends "/shared/base_layout.html" %}

{% block body %}

    <header>
        <h1>{% block maintitle %}
            <a href="{{ route_url('index') }}">pyshop</a>
        </h1>
         {% if pyshop.user %}
            <figure>
                {% trans %}Logged as {% endtrans %}
                {{pyshop.login}}
                <a href="{{route_url('logout')}}">
                  {% trans %}Sign out{% endtrans %}
                </a>
            </figure>
        {% endif %}
        {% endblock %}
        <nav class="mainnav">
            {% block mainnav %}
                {%if has_permission('admin_view') %}
                    <a href="{{route_url('list_user')}}">
                        {% trans %}Manage Accounts{% endtrans %}
                    </a>
                {% endif %}
            {% endblock %}
        </nav>
        <nav class="subnav">
            {% block subnav %}
            {% endblock %}
        </nav>
    </header>
    <section class="main">
        <article class="page">
            {% block title %}{% endblock %}
            {% block messages %}
                {% block error %}
                    {% if errormessage %}
                        <div class="error">
                            <span>{{ errormessage }}</span>
                        </div>
                    {% endif %}
                    {% if errors %}
                        <ul class="errors">
                            {% for msg in errors %}
                                <li>{{ msg }}</li>
                            {% endfor %}
                        </ul>
                    {% endif %}
                {% endblock %}
                {% block warn %}
                    {% if warnmessage %}
                        <div class="warn">
                            <span>{{ warnmessage }}</span>
                        </div>
                    {% endif %}
                {% endblock %}
                {% block info %}
                    {% if infomessage %}
                        <div class="info">
                            <span>{{ infomessage }}</span>
                        </div>
                    {% endif %}
                {% endblock %}
            {% endblock %}
            <div>
                <section>
                    {% block main %}
                    {% endblock %}
                </section>
            </div>
            <footer class="paging">
                {% block paging %}
                    {% include "/shared/paging.html" %}
                {% endblock %}
            </footer>
        </article>
    </section>
    <footer>
        <div>
            <a href="https://github.com/mardiros/pyshop/">
                pyshop v{{pyshop.version}}
            </a>
        </div>
    </footer>
{% endblock %}
