{% extends "newman/ajax_content_base.html" %}
{% load cache %}

{% cache 300 'nm-app-index' app_list %}
{% block breadcrumbs %}
    <div class="breadcrumbs">
        <a href="{% url newman:index %}#/nm/">{% trans "Home" %}</a>
        &rsaquo;
        {% for app in app_list %}
            {% trans app.name %}
        {% endfor %}
    </div>
{% endblock %}

{% block content_toolbar %}{% endblock %}

{% block content %}
    {% if app_list %}
        {% for app in app_list %}
            {% for model in app.models %}
                <div class="hpbox" style="width: 200px; float: left;">
                    <h3>{{ model.name }}</h3>
                    <div class="cnt">
                        <ul style="list-style: none; margin: 15px 5px;">
                            {% if model.perms.add %}
                                <li><a style="display: block;" class="icn btn add js-hashadr" href="{{ model.admin_url }}add/">{% trans 'Add' %}</a></li>
                            {% endif %}
                            {% if model.perms.change %}
                                <li><a style="display: block;" class="icn btn edit js-hashadr" href="{{ model.admin_url }}">{% trans 'Change' %}</a></li>
                            {% endif %}
                        </ul>
                    </div>
                </div>
            {% endfor %}
        {% endfor %}
    {% else %}
        <p>{% trans "You don't have permission to edit anything." %}</p>
    {% endif %}
{% endblock %}

{% block content_js %}
    <script type="text/javascript">
    request_media('{{ NEWMAN_MEDIA_URL }}css/dashboard.css');
    </script>
{% endblock %}
{% endcache %}
