Sha256: 337ad06e03dc3228a539ead842409f9f02eeaa4d77bf4331ce6da2e41b9bc30b

Contents?: true

Size: 757 Bytes

Versions: 27

Compression:

Stored size: 757 Bytes

Contents

$ = jQuery

# Adds plugin object to jQuery
$.fn.extend
  nested_attributes_sortable: (options) ->
# Default settings
    settings =
      field: null #campo obbligatorio

    # Merge default settings with options.
    settings = $.extend settings, options

    console.error('field required for nested_attributes_sortable') if settings.field == ''

    return @each ()->
      $(@).sortable(
        update: (event, ui)->
          console.log(arguments);
          $(event.target).find(settings.field).each (i)->
            $(@).val(i)
          $(event.target).find('*').trigger('parent_sorted', event.target);
        stop:(event)->
          $(event.target).find('*').trigger('parent_stop_sorted', event.target);
      );
      $(@).disableSelection();

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
alchemy-custom-model-3.2 app/assets/javascripts/alchemy-custom-model/nested_attributes_sortable.js.coffee
alchemy-custom-model-3.1.5 app/assets/javascripts/alchemy-custom-model/nested_attributes_sortable.js.coffee
alchemy-custom-model-3.1.4 app/assets/javascripts/alchemy-custom-model/nested_attributes_sortable.js.coffee
alchemy-custom-model-3.1.3 app/assets/javascripts/alchemy-custom-model/nested_attributes_sortable.js.coffee
alchemy-custom-model-3.1.2 app/assets/javascripts/alchemy-custom-model/nested_attributes_sortable.js.coffee
alchemy-custom-model-3.1.1 app/assets/javascripts/alchemy-custom-model/nested_attributes_sortable.js.coffee
alchemy-custom-model-3.1.0 app/assets/javascripts/alchemy-custom-model/nested_attributes_sortable.js.coffee
alchemy-custom-model-2.2.2 app/assets/javascripts/alchemy-custom-model/nested_attributes_sortable.js.coffee
alchemy-custom-model-3.0.0 app/assets/javascripts/alchemy-custom-model/nested_attributes_sortable.js.coffee
alchemy-custom-model-2.2.1 app/assets/javascripts/alchemy-custom-model/nested_attributes_sortable.js.coffee
alchemy-custom-model-2.2.0 app/assets/javascripts/alchemy-custom-model/nested_attributes_sortable.js.coffee
alchemy-custom-model-2.1.2 app/assets/javascripts/alchemy-custom-model/nested_attributes_sortable.js.coffee
alchemy-custom-model-2.1.1 app/assets/javascripts/alchemy-custom-model/nested_attributes_sortable.js.coffee
alchemy-custom-model-2.1.0 app/assets/javascripts/alchemy-custom-model/nested_attributes_sortable.js.coffee
alchemy-custom-model-2.0.3 app/assets/javascripts/alchemy-custom-model/nested_attributes_sortable.js.coffee
alchemy-custom-model-2.0.2 app/assets/javascripts/alchemy-custom-model/nested_attributes_sortable.js.coffee
alchemy-custom-model-2.0.1 app/assets/javascripts/alchemy-custom-model/nested_attributes_sortable.js.coffee
alchemy-custom-model-2.0.0 app/assets/javascripts/alchemy-custom-model/nested_attributes_sortable.js.coffee
alchemy-custom-model-0.1.9 app/assets/javascripts/alchemy-custom-model/nested_attributes_sortable.js.coffee
alchemy-custom-model-0.1.7 app/assets/javascripts/alchemy-custom-model/nested_attributes_sortable.js.coffee