app/controllers/report_controller.rb
# Check for parent nodes missing from vandt tree and return them if any
Check for parent nodes missing from vandt tree and return them if any
Check for parent nodes missing from vandt tree and return them if any
def open_parent_nodes
    existing_node = nil                     
    nodes = params[:id].split('_')
    nodes.pop
    parents = []
    nodes.each do |node|
      parents.push(:id => node.split('xx-').last)
    end
    unless parents.empty? || 
           x_tree[:open_nodes].include?(x_build_node_id(parents.last))
      parents.reverse_each do |p|
        p_node = x_build_node_id(p)
        x_tree[:open_nodes].push(p_node) unless x_tree[:open_nodes].include?(p_node)
        existing_node = p_node
      end
    end
    add_nodes = {:key      => existing_node,
                 :children => tree_add_child_nodes(existing_node)} if existing_node
    self.x_node = params[:id]
    add_nodes
  end
def open_parent_nodes existing_node = nil nodes = params [ :id ] . split ( '_' ) nodes . pop parents = [ ] nodes . each do | node | parents . push ( :id => node . split ( 'xx-' ) . last ) end unless parents . empty? || x_tree [ :open_nodes ] . include? ( x_build_node_id ( parents . last ) ) parents . reverse_each do | p | p_node = x_build_node_id ( p ) x_tree [ :open_nodes ] . push ( p_node ) unless x_tree [ :open_nodes ] . include? ( p_node ) existing_node = p_node end end add_nodes = { :key => existing_node , :children => tree_add_child_nodes ( existing_node ) } if existing_node self . x_node = params [ :id ] add_nodes end
Check for parent nodes missing from vandt tree and return them if any
Check for parent nodes missing from vandt tree and return them if any
# Init var # Go up thru the parents and find the highest level unopened, mark all as opened along the way # Skip if no parents or parent already open # some of the folder nodes are not autoloaded # that's why they already exist in open_nodes