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

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

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

{% block browser_title %}{% blocktrans %}Live documents{% endblocktrans %}{% endblock %}
{% block page_title %}{% blocktrans %}Live documents{% endblocktrans %}{% endblock %}

{% block content %}
  {% if document_types %}
    <a class="btn green waves-effect waves-light dropdown-trigger" href="#" data-target="widget-dropdown">
      <i class="material-icons left">add</i>
      {% trans "Create live document" %}
    </a>

    <ul id="widget-dropdown" class="dropdown-content">
      {% for ct, model in document_types %}
        <li>
          <a href="{% url 'create_live_document' ct.app_label ct.model %}">
            {% verbose_name_object model as document_name %}
            {% blocktrans with name=document_name %}Create {{ name }}{% endblocktrans %}
          </a>
        </li>
      {% endfor %}
    </ul>
  {% else %}
    <figure class="alert primary">
      <i class="material-icons left">info</i>
      {% trans "There is no app installed which registers any live document types." %}
    </figure>
  {% endif %}

  {% render_table table %}
{% endblock %}
