{% extends "vantage/base.html" %} {% load static vantage vantage_slots i18n %} {% comment %} The dashboard is a grid of cards. Everything here arrived as plain data from vantage.dashboards — already permission filtered, already computed, already isolated from its neighbours' failures — so this file lays cards out and does nothing else. Two modes, one grid. Normally the cards are drawn and that is the whole page. With ?arrange=1 the same grid is wrapped in a form, each card grows a strip of controls, and an editor panel appears beneath it. The arranging mode is a URL rather than a stored flag: it is something you are doing for the next thirty seconds, and a page you can leave and come back to is the cheapest way to say so. {% endcomment %} {% block head %} {% endblock %} {% block content %}

{{ dashboard.get_title }}

{% if dashboard.description %}

{{ dashboard.description }}

{% endif %}
{% if arranging %} {% icon "check" %}{% translate "Done" %} {% else %} {% icon "sliders" %}{% translate "Arrange" %} {% if arranged %} {% translate "Arranged" context "badge: this dashboard differs from the code defaults" %} {% endif %} {% endif %}
{% slot "dashboard_top" %} {% if arranging %} {% comment %} One form around the grid and the editor together. Adding a card and rearranging the ones already there are the same submit, so a person who drags three cards and then adds a fourth does not lose the dragging. {% endcomment %}
{% csrf_token %} {% if widgets %}
{% for card in widgets %}
{% include "vantage/partials/card_controls.html" with card=card %} {% include "vantage/partials/widget.html" with card=card %}
{% endfor %}
{% else %}

{% translate "This dashboard has no cards. Add one below." %}

{% endif %} {% include "vantage/partials/card_editor.html" %}
{% elif widgets %}
{% for card in widgets %} {% include "vantage/partials/widget.html" with card=card %} {% endfor %}
{% else %}
{% icon "layout-dashboard" class="v-empty-icon" %}

{% translate "Nothing to show yet." %}

{% blocktranslate trimmed %} Register a model, or point VANTAGE["DASHBOARD"] at a Dashboard subclass to declare your own cards. {% endblocktranslate %}

{% icon "plus" %}{% translate "Add a card" %}

{% endif %} {% endblock %}