{% extends "base.html" %}
{% import '_macros.html' as macros %}

{% block content %}

<div class="jumbotron">
    <h1>Rhizom <img src="{{ url_for("static", filename="logo-64.png") }}" alt="logo" /></h1>
    <p>
        Visualisez votre réseau relationnel.
        <a href="https://gitlab.com/abompard/rhizom" class="btn btn-primary">
            Plus d'infos
        </a>
    </p>
</div>

<div class="row">

{% if graphs %}

<h2>Graphes disponibles&nbsp;:</h2>

<ul class="lead">
    {% for graph in graphs %}
    <li>
        <a href="{{ url_for('graph', graph_id=graph.id) }}">{{ graph.name }}</a>
    </li>
    {% endfor %}
</ul>

{% else %}

<p>Aucun graphe n'est disponible.</p>

{% endif %}

{% if current_user.is_authenticated() %}

<div class="newgraph">
<hr />

<h3>Nouveau graphe</h3>

<form role="form" method="post" class="form-inline">
    {{ new_form.hidden_tag() }}
    <p>
        Créer un graphe vierge&nbsp;: {{ macros.render_field(new_form.name, class="input-sm") }}
        <button type="submit" name="formname" value="new"
                class="btn btn-sm btn-primary">Créer</button>
    </p>
</form>

{% if graphs %}
<form role="form" method="post" class="form-inline">
    {{ copy_form.hidden_tag() }}
    <p>
        Ou à partir d'un graphe existant&nbsp;:
        {{ macros.render_field(copy_form.existing, class="form-control input-sm") }}
        <button type="submit" name="formname" value="copy"
                class="btn btn-sm btn-default">Copier</button>
</form>
{% endif %}

</div>

{% else %}

<p class="text-info">Vous devez vous connecter pour voir les graphes&nbsp;:
    &nbsp; <img src="{{ url_for('static', filename='signin.png') }}" alt="Login" class="signin " />
</p>

{% endif %}

</div>

{% endblock %}
