Skip to content
Snippets Groups Projects
Unverified Commit cb84eb88 authored by Arnaud Levy's avatar Arnaud Levy Committed by GitHub
Browse files

split (#2381)

parent 73e388d0
No related branches found
No related tags found
No related merge requests found
......@@ -8,16 +8,19 @@ module Admin::Reorderable
object = model.find_by(id: id)
object.update_column(:position, index + 1) unless object.nil?
end
if first_object&.respond_to?(:is_direct_object?)
first_object.is_direct_object? ? first_object.sync_with_git
: first_object.touch # Sync indirect object's direct sources through after_touch
end
sync_after_reorder(first_object)
# Used to add extra code
yield first_object if block_given?
end
protected
def sync_after_reorder(first_object)
return unless first_object&.respond_to?(:is_direct_object?)
first_object.is_direct_object? ? first_object.sync_with_git
: first_object.touch # Sync indirect object's direct sources through after_touch
end
def model
self.class.to_s.remove('Admin::').remove('Controller').singularize.safe_constantize
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment