{% load i18n djangocms_modules_tags sekizai_tags %}
{% get_module_categories as module_categories %}

{% for category in module_categories %}
    <div class="cms-submenu-item cms-submenu-item-title"><span class="cms-submenu-item-title-module"><ins class="cms-modules-icon">{% trans "Apps:" %}</ins> {{ category.name|capfirst }}</span></div>
    {% for module in category.get_non_empty_modules %}
        <div class="cms-submenu-item"><a data-rel="add" href="{{ module.plugin_type }}" data-url="{% get_module_add_url module %}">{{ module.module_name }}</a></div>
    {% endfor %}
{% endfor %}

{% regroup plugin_menu by module as module_list %}
{% for module in module_list %}
    <div class="cms-submenu-item cms-submenu-item-title"><span>{% if module.grouper %}{{ module.grouper|capfirst }}{% else %}{% trans "Available plugins" %}{% endif %}</span></div>
    {% for p in module.list %}
        {% if p.value != 'AliasPlugin' and p.value != 'PlaceholderPlugin' and p.value != 'Module' %}
            <div class="cms-submenu-item"><a data-rel="add" href="{{ p.value }}">{{ p.name }}</a></div>
        {% endif %}
    {% endfor %}
{% endfor %}
