Sha256: 578d5306ef2c0e2e66954d4793b4605535b85f8fea432926c78d60ea29ff85ca
Contents?: true
Size: 801 Bytes
Versions: 1
Compression:
Stored size: 801 Bytes
Contents
# -*- coding: utf-8 -*- module ActiveAdmin module Views # = Index as a Nested Set # # Shows index page as a tree # # index :as => :nested_set do |product| # Another options for table # link_to(image_tag(product.image_path), admin_products_path(product)) # end # class IndexAsNestedSet < IndexAsTable def build(page_presenter, collection) super page_presenter, get_nested_set( resource_class ) end protected def get_nested_set class_or_item result = [] roots = class_or_item.respond_to?(:roots) ? class_or_item.roots : class_or_item items = roots.each do |root| result += root.self_and_descendants.to_a.compact end result end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
active_admin-awesome_nested_set-0.0.8 | lib/active_admin/views/index_as_nested_set.rb |