{% import '_macros.html' as macros %}
<!DOCTYPE html>
<html lang="fr">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>{% block title %}{% if graph %}{{ graph.name }} | {% endif %}Rhizom{% endblock %}</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
    <!--<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap-theme.min.css">-->
    <link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}" />
    <link rel="icon" href="{{ url_for('static', filename='favicon.ico') }}" />
    {% block more_headers %}{% endblock %}
</head>
<body>

<nav class="navbar navbar-default" role="navigation">
    <div class="container">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
        {% if current_user.is_authenticated() %}
        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
        </button>
        {% endif %}
        <a class="navbar-brand" href="{{ url_for('index') }}">
            <img src="{{ url_for("static", filename="logo-24.png") }}" alt="logo" />
            Rhizom{% if graph %}&nbsp;: {{ graph.name }}{% endif %}
        </a>
    </div>
    {% if current_user.is_authenticated() %}
    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
        <p class="navbar-text navbar-right">
            {{ current_user.name }}
            (<a class="navbar-link signout" href="{{ url_for('logout') }}">logout</a>)
        </p>
        <ul class="nav navbar-nav navbar-right">
            {% if graph %}
                {{ macros.render_nav_item(url_for('graph', graph_id=graph.id), "Voir") }}
                {% if current_user.has_perm(graph, 'edit') %}
                    {{ macros.render_nav_item(url_for('edit', graph_id=graph.id), "Modifier") }}
                {% endif %}
                {% if current_user.has_perm(graph, 'admin') %}
                    {{ macros.render_nav_item(url_for('admin', graph_id=graph.id), "Admin") }}
                {% endif %}
            {% endif %}
            {% if current_user.is_master %}
                {{ macros.render_nav_item(url_for('users'), "Utilisateurs") }}
            {% endif %}
        </ul>
    </div><!-- /.navbar-collapse -->
    {% endif %}
    </div><!-- /.container -->
</nav>


<div class="container">

{% with messages = get_flashed_messages(with_categories=true) %}
{% for category, message in messages %}
<div class="row flashmessage {% if category == "success" %}dismissible{% endif %}">
    <div class="col-xs-12">
        <div class="alert alert-{{ category }} {% if category == "success" %}alert-dismissible{% endif %}" role="alert">
            {% if category == "success" %}
            <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
            {% endif %}
            {{ message }}
        </div>
    </div>
</div>
{% endfor %}
{% endwith %}

{% block content %}{% endblock %}

</div> <!-- /container -->


<footer id="footer" class="container">
<hr />
<p>
    <a href="https://gitlab.com/abompard/rhizom">Projet Rhizom</a>,
    réalisé par Aurélien. Pour toute remarque, idée, ajout, correction,
    insulte&nbsp;: <a href="mailto:aurelien@bompard.org">écrivez-moi</a>.
</p>
</footer>


<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
<script src="https://login.persona.org/include.js"></script>
<script>
//<![CDATA[
    {% if current_user.is_authenticated() %}
    var currentUser = {{ current_user.email|tojson|safe }};
    {% else %}
    var currentUser = null;
    {% endif %}
    var loginUrl = {{ url_for('login')|tojson|safe }},
        logoutUrl = {{ url_for('logout')|tojson|safe }};
//]]>
</script>
<script src="{{ url_for('static', filename='actions.js') }}"></script>
{% block more_js %}{% endblock %}

</body>
</html>
