Hobo Cookbook

View Source



An enhanced version of Rapid’s <collection> tag that supports drag-and-drop re-ordering.

Each item in the collection has a <div class="ordering-handle" param="handle"> added, which can be used to drag the item up and down.


  • item
    • handle
    • default
      • card


  • sortable-options - a hash of options to pass to the sortable_elemnt helper. Default are:

     { :constraint => :vertical,
       :overlap => :vertical,
       :scroll => :window,
       :handle => 'ordering-handle',
       :complete => [visual_effect(:highlight, attributes[:id])] }

Controller support

This tag assumes the controller has a reorder action. This action is added automatically by Hobo’s model-controller if the model declares acts_as_list. See also Drag and Drop Reordering in the Controllers and Routing chapter of the manual.

Show Source


No comments to display