{# -*- engine:django -*- #}

{% extends "core/base.html" %}

{% load i18n data_helpers rules %}
{% load render_table from django_tables2 %}

{% block browser_title %}{% blocktrans %}Dashboard widgets{% endblocktrans %}{% endblock %}
{% block page_title %}{% blocktrans %}Dashboard widgets{% endblocktrans %}{% endblock %}

{% block content %}

  <a class="btn green waves-effect waves-light dropdown-trigger" href="#" data-target="widget-dropdown">
    <i class="material-icons left iconify" data-icon="mdi:add"></i>
    {% trans "Create dashboard widget" %}
  </a>
  <ul id="widget-dropdown" class="dropdown-content">
    {% for ct, model in widget_types %}
      <li>
        <a href="{% url 'create_dashboard_widget' ct.app_label ct.model %}">
          {% verbose_name_object model as widget_name %}
          {% blocktrans with name=widget_name %}Create {{ name }}{% endblocktrans %}
        </a>
      </li>
    {% endfor %}
  </ul>

  {% has_perm "core.edit_default_dashboard_rule" user as can_edit_default_dashboard %}
  {% if can_edit_default_dashboard %}
    <a class="btn orange waves-effect waves-light" href="{% url "edit_default_dashboard" %}">
      <i class="material-icons left iconify" data-icon="mdi:pencil-outline"></i>
      {% trans "Edit default dashboard" %}
    </a>
  {% endif %}

  {% render_table table %}
{% endblock %}
