Skip to content

Commit

Permalink
Port list reordering fix to update_child_positions too so that nested…
Browse files Browse the repository at this point in the history
… items are ordered correctly too.
  • Loading branch information
parndt authored and robyurkowski committed Aug 18, 2012
1 parent 3239c55 commit 98433a4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/lib/refinery/crud.rb
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ def update_positions
def update_child_positions(_node, #{singular_name})
list = _node['children']['0']
list.sort.map { |item| item[1] }.each_with_index do |child, index|
list.sort_by {|k, v| k.to_i}.map { |item| item[1] }.each_with_index do |child, index|
child_id = child['id'].split(/#{singular_name}\_?/).reject(&:empty?).first
child_#{singular_name} = #{class_name}.where(:id => child_id).first
child_#{singular_name}.move_to_child_of(#{singular_name})
Expand Down

0 comments on commit 98433a4

Please sign in to comment.