Sha256: fda9685bceac62525126981e460e42aa3a2c9ed95c38636b8e5a86191d14a0f7
Contents?: true
Size: 1.2 KB
Versions: 1
Compression:
Stored size: 1.2 KB
Contents
require 'awesome_nested_set/helper' include CollectiveIdea::Acts::NestedSet::Helper module SortableNestedSetHelper def sortable_nested_set_tree(class_or_category) if class_or_category.is_a? Class @category_class = class_or_category @categories = class_or_category.all :include => class_or_category.sns_items_type, :order => :lft else @category_class = class_or_category.class @categories = class_or_category.self_and_descendants_with_items @root = class_or_category end @sortable_ids = @categories.collect &:id render 'sortable_nested_set/tree', :category_class => @category_class, :categories => @categories, :sortable_ids => @sortable_ids, :root => @root end def sns_lineage(category, options=Hash.new) content_tag :p, category.lineage(options).collect { |a| link_to(a.name, a) } .join(image_tag('folder_closed.png', :class => :descent)).html_safe end def sns_options(class_or_category, mover=nil) nested_set_options(class_or_category, mover) { |category| "#{'.' * category.level} #{category.name}" } end end ActionView::Base.send :include, SortableNestedSetHelper
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sortable_nested_set-0.1.24 | app/helpers/sortable_nested_set_helper.rb |