{% load i18n l10n cms_tags %}
{% with allow_children=plugin.get_plugin_class.allow_children disable_child_plugins=plugin.get_plugin_class.disable_child_plugins %}
    <div class="cms-draggable cms-draggable-{{ plugin.pk|unlocalize }} {% if not allow_children %}cms-draggable-disabled{% endif %} {% if clipboard %}cms-draggable-from-clipboard{% endif %}">
        <div class="cms-dragitem cms-dragitem-handler {% if plugin.child_plugin_instances %}cms-dragitem-collapsable{% endif %}">
            {% if not disabled_child %}
                <div class="cms-submenu-btn cms-submenu-edit cms-btn" data-rel="edit">
                    <span class="cms-hover-tooltip cms-hover-tooltip-left cms-hover-tooltip-delay"
                          data-cms-tooltip="{% trans "></span>
                </div>
                <div class="cms-submenu-btn cms-submenu-add cms-btn {% if not allow_children %}cms-btn-disabled{% endif %}">
                    {% if not allow_children %}
                        <span class="cms-hover-tooltip" data-cms-tooltip="{% trans "></span>
                    {% else %}
                        <span class="cms-hover-tooltip cms-hover-tooltip-left cms-hover-tooltip-delay"
                              data-cms-tooltip="{% trans "></span>
                    {% endif %}
                </div>
                <div class="cms-submenu cms-submenu-settings cms-submenu-btn cms-btn"></div>
            {% else %}
                <div class="cms-hover-tooltip cms-hover-tooltip-left cms-plugin-disabled"
                     tabindex="-1"
                     data-cms-tooltip="{% trans ">
                    <span class="cms-icon cms-icon-lock"></span>
                </div>
            {% endif %}
            <div class="cms-submenu-dropdown cms-submenu-dropdown-settings">
                <div class="cms-dropdown-inner">
                    <div class="cms-submenu-item">
                        <a data-cms-icon="scissors" data-rel="cut" href="#">
                            {% trans "Cut" %}
                        </a>
                    </div>
                    <div class="cms-submenu-item">
                        <a data-cms-icon="copy" data-rel="copy" href="#">
                            {% trans "Copy" %}
                        </a>
                    </div>
                    <div class="cms-submenu-item">
                        <a data-cms-icon="paste" data-rel="paste" href="#">
                            {% trans "Paste" %}
                        </a>
                        <span class="cms-submenu-item-paste-tooltip cms-submenu-item-paste-tooltip-empty cms-hover-tooltip cms-hover-tooltip-left cms-hover-tooltip-delay"
                              data-cms-tooltip="{% trans "></span>
                        <span class="cms-submenu-item-paste-tooltip cms-submenu-item-paste-tooltip-restricted cms-hover-tooltip cms-hover-tooltip-left cms-hover-tooltip-delay"
                              data-cms-tooltip="{% trans "></span>
                        <span class="cms-submenu-item-paste-tooltip cms-submenu-item-paste-tooltip-disabled cms-hover-tooltip cms-hover-tooltip-left cms-hover-tooltip-delay"
                              data-cms-tooltip="{% trans "></span>
                    </div>
                    <div class="cms-submenu-item">
                        <a data-cms-icon="bin" data-rel="delete" href="#">
                            {% trans "Delete" %}
                        </a>
                    </div>
                    {% render_extra_menu_items plugin %}
                </div>
            </div>
            {% if not clipboard %}
                <div class="cms-plugin-picker" data-touch-action="pan-y">
                    <div class="cms-quicksearch">
                        <label>
                            <input type="text" placeholder="{% trans 'Filter plugins...' %}" />
                        </label>
                    </div>
                    {# plugin child classes here #}
                </div>
            {% endif %}
            <span class="cms-dragitem-text" title="{{ plugin.plugin_type }} ID: {{ plugin.pk }}">
                <strong>{{ plugin.get_plugin_name }}</strong>
                {{ plugin.get_short_description }}
            </span>
        </div>
        <div class="cms-collapsable-container cms-hidden {% if allow_children %}cms-draggables{% endif %}">
            {% if plugin.child_plugin_instances %}
                {% for child in plugin.child_plugin_instances %}
                    {% include cms_toolbar.templates.drag_item_template with plugin=child disabled_child=disable_child_plugins %}{% endfor %}
                {% endif %}
            </div>
        </div>
    {% endwith %}
