{# Source code of the Ubuntu-it website
 # Copyright (C) 2015-2018  Pietro Albini <pietroalbini@ubuntu.com>
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU Affero General Public License as published
 # by the Free Software Foundation, either version 3 of the License, or
 # (at your option) any later version.
 #
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; witout even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU Affero General Public License for more details.
 #
 # You should have received a copy of the GNU Affero General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #}

{% from "macros.html" import nav_item with context %}

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />

        <title>{% block title %}Senza titolo{% endblock %} - Ubuntu-it</title>

        <link rel="stylesheet" href="https://static.ubuntu-it.org/fonts/ubuntu/include.min.css">
        <link rel="stylesheet" href="https://static.ubuntu-it.org/themes/italy/theme.min.css">
        <link rel="stylesheet" href="{{ url_for("static", filename="website.css") }}">
        <link rel="shortcut icon" href="{{ url_for("static", filename="favicon.ico") }}">

        {% block extra_header %}{% endblock %}
    </head>

    <body {% block extra_body %}{% endblock %}>
        <div class="cookie-policy hidden">
            <div class="container">
                <span>
                    Questo sito utilizza i cookie per offrirti un'esperienza
                    migliore. Continuando la navigazione ne accetti l'uso.
                </span>
                <a href="{{ url_for("pages.cookies") }}" id="ubuntuit-cookiepolicy-hide">OK</a>
                <a href="#">Maggiori informazioni</a>
            </div>
        </div>

        {% if g.auth_name %}
        <nav class="sites-list">
            <div class="container">
                <ul class="left">
                    {% if permission("auth.sessions.manage") %}
                    <li><a href="{{ url_for("auth.sessions_list") }}">
                        Sessioni attive: {{ g.auth_sessions_count }}
                    </a></li>
                    {% endif %}
                    {% if permission("actions.show") %}
                    <li><a href="{{ url_for("actions.show") }}">
                        Azioni recenti
                    </a></li>
                    {% endif %}
                </ul>
                <ul class="right">
                    {% if permission("auth.sessions.own") %}
                    <li><a href="{{ url_for("auth.sessions_show", id=g.auth_id) }}">
                        {{ g.auth_name }}
                    </a></li>
                    {% endif %}
                    {% if permission("auth.logout") %}
                    <li><a href="{{ url_for("auth.logout") }}">Esci</a></li>
                    {% endif %}
                </ul>
            </div>
        </nav>
        {% endif %}

        <nav class="sites-list">
            <div class="container">
                <ul>
                    <li><a href="{{ url_for('pages.index') }}" class="active">Sito web</a></li>
                    <li><a href="https://wiki.ubuntu-it.org">Wiki</a></li>
                    <li><a href="https://forum.ubuntu-it.org">Forum</a></li>
                    <li><a href="https://chiedi.ubuntu-it.org">Chiedi</a></li>
                    <li><a href="https://chat.ubuntu-it.org">Chat</a></li>
                    <li><a href="https://cerca.ubuntu-it.org">Cerca</a></li>
                    <li><a href="https://planet.ubuntu-it.org">Planet</a></li>
                </ul>
                <ul class="right">
                    <li><a href="https://www.facebook.com/ubuntu.it">Facebook</a></li>
                    <li><a href="https://twitter.com/ubuntuit">Twitter</a></li>
                    <li><a href="https://www.youtube.com/ubuntuitpromozione">YouTube</a></li>
                    <li><a href="https://telegram.me/ubuntuit">Telegram</a></li>
                </ul>
            </div>
        </nav>

        {% for navbar in _navbars %}
            <nav {%- if loop.index == 1 %} class="main-navbar"{% endif %}>
                <div class="container">
                    <ul>
                        {% if loop.index == 1 %}
                        <li class="site-name"><a href="{{ url_for("pages.index") }}">ubuntu-it</a></li>
                        {% endif -%}

                        {%- for name, url, active in navbar %}
                        <li>
                            <a {%- if active %} class="active"{% endif %} href="{{ url }}">{{ name }}</a>
                        </li>
                        {% endfor %}
                    </ul>
                </div>
            </nav>
        {% endfor %}

        <div class="container">
            {% with messages = get_flashed_messages(with_categories=True) %}
                {% if messages %}
                    {% for category, message in messages %}
                        <div class="alert {% if category != "message" %}{{ category }}{% else %}info{% endif %}">
                            {{ message }}
                            <span class="close">&times;</span>
                        </div>
                    {% endfor %}
                {% endif %}
            {% endwith %}

            {% block content %}{% endblock %}

            <footer>
                <p>
                    Ubuntu e Canonical sono marchi registrati da Canonical
                    Ltd.
                </p>
                <p>
                    Sito web realizzato dal Gruppo Web di Ubuntu-it, con
                    <a href="https://www.python.org/">Python</a>,
                    <a href="https://www.palletsproject.com/p/flask/">Flask</a> e
                    <a href="https://www.sqlite.org/">SQLite</a>.
                </p>
                <ul>
                    <li><a href="{{ url_for("pages.cookies") }}">
                        Informativa sui cookie
                    </a></li>
                    <li><a href="https://code.ubuntu-it.org/ubuntu-it-web/www/issues">
                        Segnala un problema
                    </a></li>
                    <li><a href="https://code.ubuntu-it.org/ubuntu-it-web/www">
                        Codice sorgente
                    </a></li>
                    <li><a href="https://wiki.ubuntu-it.org/GruppoWeb">
                        Collabora con noi
                    </a></li>
                </ul>
            </footer>
        </div>

        <script type="text/javascript" src="https://static.ubuntu-it.org/themes/italy/theme.min.js"></script>
    </body>
</html>
