Sha256: 2b2c74fe50ae5521b1f1863b22f4b2eafd54be4a6a2520e3fb913ec28cfac85f

Contents?: true

Size: 1.07 KB

Versions: 40

Compression:

Stored size: 1.07 KB

Contents

#= require jquery-ui/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

40 entries across 40 versions & 1 rubygems

Version Path
redde-0.3.39 app/assets/javascripts/redde/sortTree/index.js.coffee
redde-0.3.38 app/assets/javascripts/redde/sortTree/index.js.coffee
redde-0.3.37 app/assets/javascripts/redde/sortTree/index.js.coffee
redde-0.3.36 app/assets/javascripts/redde/sortTree/index.js.coffee
redde-0.3.35 app/assets/javascripts/redde/sortTree/index.js.coffee
redde-0.3.34 app/assets/javascripts/redde/sortTree/index.js.coffee
redde-0.3.33 app/assets/javascripts/redde/sortTree/index.js.coffee
redde-0.3.32 app/assets/javascripts/redde/sortTree/index.js.coffee
redde-0.3.31 app/assets/javascripts/redde/sortTree/index.js.coffee
redde-0.3.30 app/assets/javascripts/redde/sortTree/index.js.coffee
redde-0.3.29 app/assets/javascripts/redde/sortTree/index.js.coffee
redde-0.3.28 app/assets/javascripts/redde/sortTree/index.js.coffee
redde-0.3.27 app/assets/javascripts/redde/sortTree/index.js.coffee
redde-0.3.26 app/assets/javascripts/redde/sortTree/index.js.coffee
redde-0.3.25 app/assets/javascripts/redde/sortTree/index.js.coffee
redde-0.3.24 app/assets/javascripts/redde/sortTree/index.js.coffee
redde-0.3.23 app/assets/javascripts/redde/sortTree/index.js.coffee
redde-0.3.22 app/assets/javascripts/redde/sortTree/index.js.coffee
redde-0.3.21 app/assets/javascripts/redde/sortTree/index.js.coffee
redde-0.3.20 app/assets/javascripts/redde/sortTree/index.js.coffee