Module: CopyMoveHelper
- Defined in:
- app/helpers/copy_move_helper.rb
Instance Method Summary collapse
Instance Method Details
#build_tree(page, list, level = 0) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/helpers/copy_move_helper.rb', line 11 def build_tree(page, list, level = 0) label = "#{'-'*level}#{page.title}" id = page.id list << [label, id] return list if page.fields.select{|f| f.name == "exclude_children_from_copy_move_target"}.any? return list if Radiant::Config["copy_move.exclude_archive_children"] && page.class_name =~ /ArchivePage/ page.children.each do |p| build_tree p, list, level + 1 end list end |
#page_parent_select_tag ⇒ Object
2 3 4 5 6 7 8 9 |
# File 'app/helpers/copy_move_helper.rb', line 2 def page_parent_select_tag homes = Object.const_defined?(:MultiSiteExtension) ? [ Page.current_site.homepage ] : Page.find_all_by_parent_id(nil) list = homes.inject([]) do |l, home| l.concat build_tree(home, []) end = list, (@page.parent ? @page.parent.id : nil) select_tag 'parent_id', end |