Sha256: 6a316e003242997f808d1338999aceb9ad87185cabc20fc475da9da9f2cf13f5

Contents?: true

Size: 1.08 KB

Versions: 5

Compression:

Stored size: 1.08 KB

Contents

#= require jquery-ui/widgets/sortable
#= require ./jquery.mjs.nestedSortable.js

$ ->
  $('[data-sort-tree]').each ->
    $this = $(this)

    opts = $this.data('sort-tree')

    if $.isPlainObject( opts ) && opts.url
      url = opts.url
      delete opts.url
    else if (typeof opts == 'string') && opts != ""
      url = opts
      opts = {}

    unless url? || url == ""
      url = location.pathname + "/sort"

    defs =
      # disableNesting: 'no-nest'
      # handle: '[data-sort-tree-handle]'
      # listType: 'ol'
      forcePlaceholderSize: true
      helper: 'clone'
      items: '[data-sort-tree-item]'
      maxLevels: 2
      opacity: .6
      placeholder: 'sort-tree__placeholder'
      revert: 250
      rootID: 'root'
      tabSize: 25
      tolerance: 'pointer'
      toleranceElement: '[data-sort-tree-tolerance]'
      errorClass: 'sort-tree__error'
      update: ->
        serialized = $this.nestedSortable('serialize')
        $.ajax
          method: 'POST'
          url: url
          data: serialized

    $this.nestedSortable $.extend( {}, defs, opts )

    return

  return

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
redde-0.4.4 app/assets/javascripts/redde/sortTree/index.js.coffee
redde-0.4.3 app/assets/javascripts/redde/sortTree/index.js.coffee
redde-0.4.2 app/assets/javascripts/redde/sortTree/index.js.coffee
redde-0.4.1 app/assets/javascripts/redde/sortTree/index.js.coffee
redde-0.4.0 app/assets/javascripts/redde/sortTree/index.js.coffee