Sha256: 568bf9112cf476e962b6cdf5b438f008ff7ae3635dc622a61b92bb31176241c2
Contents?: true
Size: 1.58 KB
Versions: 22
Compression:
Stored size: 1.58 KB
Contents
<% list_id ||= "sortable_list" update_url ||= url_for(:action => "update_positions") tree ||= false content_for :head do %> <script type='text/javascript'> FastInit.addOnLoad(function() { $('reorder_action').observe('click', enable_reordering); $('reorder_action_done').observe('click', disable_reordering); }); disable_reordering = function(e) { $('<%= list_id %>').removeClassName('reordering'); Sortable.destroy("<%= list_id %>"); $('reorder_action_done').hide(); $('reorder_action').show(); if (e) { e.stop(); } } enable_reordering = function(e) { sortable_list = $('<%= list_id %>'); sortable_list.addClassName('reordering'); nest_id = 0; sortable_list.select('ul.nested').each(function(nested) { nested.id = nested.id.length > 0 ? nested.id : "nested_" + nest_id++; Sortable.create(nested.id, { constraint: <%= tree ? "false" : "'vertical'" %> , hoverclass: 'hover' , scroll: window , tree: <%= tree %> }); }); Sortable.create("<%= list_id %>", { constraint: <%= tree ? "false" : "'vertical'" %> , hoverclass: 'hover' , scroll: window , tree: <%= tree %> , onUpdate:function() { new Ajax.Updater('<%= list_id %>', '<%= update_url %>', { asynchronous:true , evalScripts:true , parameters: Sortable.serialize('<%= list_id %>') + '&tree=<%= tree %>' + '&authenticity_token=' + encodeURIComponent($('reorder_authenticity_token').value) }); } }); $('reorder_action').hide(); $('reorder_action_done').show(); if (e) { e.stop(); } } </script> <% end %>
Version data entries
22 entries across 22 versions & 1 rubygems