{% load cms_tags i18n %}
{% load url from future %}

<li id="cms_draggable-{{ plugin.pk }}" class="cms_draggable cms_reset{% if not plugin.child_plugin_instances %} cms_draggable-disabled{% endif %}">
	<div class="cms_dragitem cms_dragitem-handler{% if plugin.child_plugin_instances %} cms_dragitem-collapsable{% endif %}">
		{% language request.toolbar.language %}
		<div class="cms_switcher"></div>
		<div class="cms_submenu">
			<div class="cms_submenu-quicksearch"><label><input type="text" placeholder="{% trans "Quicksearch" %}" /></label></div>
			<ul class="cms_submenu-dropdown">
				<li><span>{% trans "Settings" %}</span></li>
				<li><a data-rel="copy" href="#">{% trans "Copy" %}</a></li>
				<li><a data-rel="edit" href="#">{% trans "Edit" %}</a></li>
				<li><a data-rel="modal" href="{% url "admin:cms_page_delete_plugin" plugin.pk %}" data-name="{% trans "Delete" %} {{ plugin.get_plugin_name }}">{% trans "Delete" %}</a></li>
				<li><a data-rel="modal" href="{% url "admin:stacks_stack_create_stack_from_plugin" placeholder_id=plugin.placeholder_id plugin_id=plugin.pk %}">{% trans "Create stack" %}</a></li>
				{% plugin_child_classes plugin %}
			</ul>
		</div>

		{% if show_language %}<span class="cms_submenu-lang">{{ plugin.language }}</span>{% endif %}
		<span class="cms_dragitem-text"><strong>{{ plugin.get_plugin_name }}</strong> {{ plugin.get_short_description }}</span>
		{% endlanguage %}
	</div>

	{% if plugin.get_plugin_class.allow_children %}<ul class="cms_draggables">{% endif %}
	{% if plugin.get_plugin_class.allow_children and plugin.num_children == 0 %}
		{# <div class="cms_reset cms_draggable cms_draggable-empty"><div class="cms_dragitem">{% trans "Drop a plugin here" %}</div></div> #}
	{% endif %}
	{% if plugin.child_plugin_instances %}
		{% for child in plugin.child_plugin_instances %}
			{# workaround because include tag does not allow recursive includes #}
			{% with template_name="cms/toolbar/draggable_item.html" %}{% include template_name with plugin=child %}{% endwith %}
		{% endfor %}
	{% endif %}
	{% if plugin.get_plugin_class.allow_children %}</ul>{% endif %}
</li>