{% extends 'base.html' %} {% load i18n %} {% load mptt_tags %} {% block title %}{% trans "List menu" %}{% endblock %} {% block content %}

{{ root.name }}

    {% recursetree menu %}
  1. {{ node.name }}
    {% if not node.is_leaf_node %}
      {{ children }}
    {% endif %}
  2. {% endrecursetree %}
{% csrf_token %}
{% endblock content %} {% block sidebar %}
{% endblock sidebar %} {% block footerscript %} $('ol.nested_sortable').nestedSortable({ disableNesting: 'no-nest', forcePlaceholderSize: true, handle: 'div', helper: 'clone', items: 'li', opacity: 0.6, placeholder: 'placeholder', tabSize: 25, tolerance: 'pointer', toleranceElement: '> div', }); $('#submit_menu').click(function(){ var tree = $('ol.nested_sortable').nestedSortable('toArray', {startDepthCount: 0}); tree = JSON.stringify(tree); $('#mptt_tree').val(tree); }); // add onclick to delete-item-buttons $("span.delete_item").each(function(index){ $(this).click(function(){ var id = $(this).attr('id').split('_'); id = id[2]; $.ajax({ url: '{% url strekmann_menu_delete tree_id %}', type: 'POST', data: 'node_id='+id, success: function(data){ location.reload(); } }); }); }); // add onclick to new-item-buttons $("span.new_item").each(function(index){ $(this).click(function(){ var id = $(this).attr('id').split('_'); id = id[2]; $.ajax({ url: '{% url strekmann_menu_new tree_id %}', type: 'GET', data: 'parent_id='+id, success: function(data){ $("#new_menu_item").html(data); } }); }); }); {% endblock footerscript %}