{% load bootstrap3 %}
{% load i18n %}
{% include 'editor/fragment_levels.html' %}

<h3>
    {{ level.title }}
    {% if level.on_top_of != None %}
        {% with level.on_top_of.title as on_top_of_level_title %}
            <small>{% blocktrans %}on top of {{ on_top_of_level_title }}{% endblocktrans %}</small>
        {% endwith %}
    {% endif %}
</h3>
{% bootstrap_messages %}
<p>
    <a class="btn btn-default btn-xs" accesskey="e" href="{% url 'editor.levels.edit' pk=level.pk %}">
        {% trans 'Level' as model_title %}
        <i class="glyphicon glyphicon-pencil"></i> {% blocktrans %}Edit {{ model_title }}{% endblocktrans %}
    </a>
</p>
<p>
    {% if level.on_top_of == None %}
        <a href="{% url 'editor.index' %}">&laquo; {% trans 'back to overview' %}</a>
    {% else %}
        <a href="{% url 'editor.levels.detail' pk=level.on_top_of.pk %}">&laquo; {% trans 'back to parent level' %}</a>
    {% endif %}
</p>

{% url 'editor.levels.graph' level=level.pk as graph_url %}
{% url 'editor.levels.overlays' level=level.pk as overlays_url %}
{% include 'editor/fragment_child_models.html' with graph_url=graph_url overlays_url=overlays_url %}

<div class="clearfix"></div>

{% if level.on_top_of is None %}
    <h3>{% trans 'Levels on top' %}</h3>
    {% if can_create_level %}
        <p>
            <a class="btn btn-default btn-xs" accesskey="n" href="{% url 'editor.levels_on_top.create' on_top_of=level.pk %}">
                <i class="glyphicon glyphicon-plus"></i> {% blocktrans %}New {{ model_title }}{% endblocktrans %}
            </a>
        </p>
    {% endif %}
    <div class="list-group">
    {% for l in levels_on_top %}
        <a href="{% url 'editor.levels.detail' pk=l.pk %}" class="list-group-item">
            {{ l.title }}
        </a>
    {% endfor %}
    </div>
{% endif %}
