{% load i18n %}

<div class="dashboard-item{% if module.collapsible %} collapsible{% endif %}{% if module.model.collapsed %} collapsed{% endif %}{% if module.deletable %} deletable{% endif %}{% if module.ajax_load %} ajax{% endif %}{% if module.draggable %} draggable{% endif %}"{% if module.ajax_load %} data-ajax-url="{% url "jet-dashboard:load_dashboard_module" pk=module.model.id %}"{% endif %} data-module-id="{{ module.model.id }}">
    <div class="dashboard-item-header">
        {% if module.draggable %}
            <span class="dashboard-item-header-drag icon-grid"></span>
        {% endif %}
        <span class="dashboard-item-header-buttons">
            <a href="{% url "jet-dashboard:update_module" pk=module.model.id %}" title="{% trans "Change" %}"><span class="icon-edit"></span></a>

            {% if module.deletable %}
                <a href="#" title="{% trans "Delete" %}" class="dashboard-item-remove"><span class="icon-cross"></span></a>
            {% endif %}
        </span>
        <span class="dashboard-item-header-title">
            {% if module.collapsible %}
                <a href="#" class="dashboard-item-collapse"><span class="dashboard-item-header-collapse-button icon-arrow-down"></span></a>
                <a href="#" class="dashboard-item-collapse"><span class="dashboard-item-header-collapse-button icon-arrow-up"></span></a>
            {% endif %}

            {% if module.title_url %}
                <a href="{{ module.title_url }}">{{ module.title }}</a>
            {% else %}
                {{ module.title }}
            {% endif %}
        </span>
        <div class="cf"></div>
    </div>

    <div class="dashboard-item-content{% if module.contrast %} contrast{% endif %}"{% if module.style %} style="{{ module.style }}"{% endif %}>
        {{ module.pre_content|default_if_none:"" }}
        {% if module.ajax_load %}
            <div class="loading-indicator-wrapper">
                <span class="icon-refresh loading-indicator"></span>
            </div>
        {% else %}
            {{ module.render }}
        {% endif %}
        {{ module.post_content|default_if_none:"" }}
    </div>
</div>
