       parent.children('.menu-item').children("input[name$='[rgt]']").val(rgt)
 
       rgt + 1
+
 
   $.fn.extend effectiveMenuEditor: (option, args...) ->
     @each ->

  class EffectiveMenuEditor
    defaults:
      menuClass: 'effective-menu'

    menu: null
    draggable: null

    constructor: (el, options) ->
      @options = $.extend({}, @defaults, options)
      @menu = $(el)

      @initDragDropEvents()
      @initCkEditorEvents()
      @initAdditionalEvents()
      true

    initDragDropEvents: ->
      @menu.on 'dragenter', 'li', (event) => event.preventDefault() if @draggable  # enable drag and drop
      @menu.on 'dragleave', 'li', (event) => event.preventDefault() if @draggable # enable drag and drop

      @menu.on 'dragstart', 'li', (event) =>
        @draggable = node = $(event.currentTarget)

        node.before(event.originalEvent.dataTransfer.getData('text/html'))

        @menu.removeClass('dragging').find('.placeholder').removeClass('placeholder')
        @menu.find('.effective-menu-expand').remove()
        @menu.find('.open').removeClass('open')
        node.parentsUntil(@menu, 'li').addClass('open')

        @draggable.remove() if @draggable
        @draggable = null
        @droppable = null

        event.stopPropagation()
        event.preventDefault()

    convertToDropdown: (node) ->
      return false if node.hasClass('dropdown') || node.hasClass('effective-menu-expand') #|| node.children('.expand').length > 0

      node.append(@menu.data('effective-menu-expand-html'))
      node.addClass('dropdown').addClass('open')
      console.log node.children('a')

      node.children('a').attr('data-toggle', 'dropdown')


    serialize: (retval) ->

