From 228186d94a4f70f0e1febeb6c9899e884ec5aba1 Mon Sep 17 00:00:00 2001 From: Marcel Molina Date: Wed, 5 Dec 2007 15:01:47 +0000 Subject: Document the supported options for sortable_element. Closes #8820 [berkelep] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8287 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- .../action_view/helpers/scriptaculous_helper.rb | 59 +++++++++++++++++++++- 1 file changed, 57 insertions(+), 2 deletions(-) (limited to 'actionpack/lib/action_view') diff --git a/actionpack/lib/action_view/helpers/scriptaculous_helper.rb b/actionpack/lib/action_view/helpers/scriptaculous_helper.rb index 83f4d168a8..de00bc3499 100644 --- a/actionpack/lib/action_view/helpers/scriptaculous_helper.rb +++ b/actionpack/lib/action_view/helpers/scriptaculous_helper.rb @@ -76,10 +76,65 @@ module ActionView # Important: For this to work, the sortable elements must have id # attributes in the form "string_identifier". For example, "item_1". Only # the identifier part of the id attribute will be serialized. + # + # Addtional +options+ are: # + # :format:: A regular expression to determine what to send + # as the serialized id to the server (the default + # is /^[^_]*_(.*)$/). + # + # :constraint:: Whether to constrain the dragging to either :horizontal + # or :vertical (or false to make it unconstrained). + # + # :overlap:: Calculate the item overlap in the :horizontal or + # :vertical direction. + # + # :tag:: Which children of the container element to treat as + # sortable (default is li). + # + # :containment:: Takes an element or array of elements to treat as + # potential drop targets (defaults to the original + # target element). + # + # :only:: A CSS class name or arry of class names used to filter + # out child elements as candidates. + # + # :scroll:: Determines whether to scroll the list during drag + # operationsif the list runs past the visual border. + # + # :tree:: Determines whether to treat nested lists as part of the + # main sortable list. This means that you can create multi- + # layer lists, and not only sort items at the same level, + # but drag and sort items between levels. + # + # :hoverclass:: If set, the Droppable will have this additional CSS class + # when an accepted Draggable is hovered over it. + # + # :handle:: Sets whether the element should only be draggable by an + # embedded handle. The value may be a string referencing a + # CSS class value (as of script.aculo.us V1.5). The first + # child/grandchild/etc. element found within the element + # that has this CSS class value will be used as the handle. # - # You can change the behaviour with various options, see - # http://script.aculo.us for more documentation. + # :ghosting:: Clones the element and drags the clone, leaving the original + # in place until the clone is dropped (defaut is false). + # + # :dropOnEmpty:: If set to true, the Sortable container will be made into + # a Droppable, that can receive a Draggable (as according to + # the containment rules) as a child element when there are no + # more elements inside (defaut is false). + # + # :onChange:: Called whenever the sort order changes while dragging. When + # dragging from one Sortable to another, the callback is + # called once on each Sortable. Gets the affected element as + # its parameter. + # + # :onUpdate:: Called when the drag ends and the Sortable's order is + # changed in any way. When dragging from one Sortable to + # another, the callback is called once on each Sortable. Gets + # the container as its parameter. + # + # See http://script.aculo.us for more documentation. def sortable_element(element_id, options = {}) javascript_tag(sortable_element_js(element_id, options).chop!) end -- cgit v1.2.3