Sha256: 5c0c6d3ea6a6fe4f2cd57a15dbfeef7813f4ae0d6ccda45f5410e7507583991a
Contents?: true
Size: 584 Bytes
Versions: 11
Compression:
Stored size: 584 Bytes
Contents
module Admin::PagesHelper def parent_pages_options roots = current_site.pages.roots.where(:slug.ne => '404').and(:_id.ne => @page.id) returning [] do |list| roots.each do |page| list = add_children_to_options(page, list) end end end def add_children_to_options(page, list) return list if page.path.include?(@page.id) || page == @page offset = '- ' * (page.depth || 0) * 2 list << ["#{offset}#{page.title}", page.id] page.children.each { |child| add_children_to_options(child, list) } list end end
Version data entries
11 entries across 11 versions & 1 rubygems