Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Port list reordering fix to update_child_positions too so that nested…

… items are ordered correctly too.
  • Loading branch information...
commit 98433a4957cb45c4d68301adaf41c4149bbd367f 1 parent 3239c55
@parndt parndt authored robyurkowski committed
Showing with 1 addition and 1 deletion.
  1. +1 −1  core/lib/refinery/crud.rb
View
2  core/lib/refinery/crud.rb
@@ -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})
Please sign in to comment.
Something went wrong with that request. Please try again.