Module: Katalyst::Content::Version
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/models/concerns/katalyst/content/version.rb
Instance Method Summary collapse
Instance Method Details
#items ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/models/concerns/katalyst/content/version.rb', line 18 def items # support building menus in memory # requires that items are added in order and index and depth are set return parent.items unless parent.persisted? items = parent.items.where(id: nodes.map(&:id)).index_by(&:id) nodes.map do |node| item = items[node.id] item.index = node.index item.depth = node.depth item end end |
#text ⇒ Object
32 33 34 |
# File 'app/models/concerns/katalyst/content/version.rb', line 32 def text items.filter_map(&:to_plain_text).join("\n") end |