app/controllers/management/sites_controller.rb
# Update the tree nodes to their current position
Update the tree nodes to their current position
Update the tree nodes to their current position
def update_tree_nodes(node, parent_id, position)
    page = SitePage.find node['id']
    page.parent_id = parent_id
    page.position = position
    page.enabled = node['enabled']
    page.save
    unless node['children'].blank?
      node['children'].each_with_index do |leaf, index|
        update_tree_nodes leaf, node['id'], index
      end
    end
  end
def update_tree_nodes ( node , parent_id , position ) page = SitePage . find node [ 'id' ] page . parent_id = parent_id page . position = position page . enabled = node [ 'enabled' ] page . save unless node [ 'children' ] . blank? node [ 'children' ] . each_with_index do | leaf , index | update_tree_nodes leaf , node [ 'id' ] , index end end end
Update the tree nodes to their current position
Update the tree nodes to their current position
node
parent_id
position