Module: Cms::Addressable
- Included in:
- Attachment, Link, Page, Section
- Defined in:
- lib/cms/addressable.rb
Defined Under Namespace
Modules: DeprecatedPageAccessors, LeafNode, NodeAccessors
Instance Method Summary collapse
-
#ancestors(options = {}) ⇒ Array<Addressable]
Returns a list of all Addressable objects that are ancestors to this record.
- #cache_parent(section) ⇒ Object
- #parent ⇒ Object
- #parent=(sec) ⇒ Object
-
#partial_for ⇒ Object
Computes the name of the partial used to render this object in the sitemap.
Instance Method Details
#ancestors(options = {}) ⇒ Array<Addressable]
Returns a list of all Addressable objects that are ancestors to this record.
16 17 18 19 20 21 |
# File 'lib/cms/addressable.rb', line 16 def ancestors(={}) ancestor_nodes = node.ancestors ancestors = ancestor_nodes.collect { |node| node.node } ancestors << self if [:include_self] ancestors end |
#cache_parent(section) ⇒ Object
28 29 30 |
# File 'lib/cms/addressable.rb', line 28 def cache_parent(section) @parent = section end |
#parent ⇒ Object
23 24 25 26 |
# File 'lib/cms/addressable.rb', line 23 def parent @parent if @parent node ? node.section : nil end |
#parent=(sec) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/cms/addressable.rb', line 32 def parent=(sec) if node node.move_to_end(sec) else build_section_node(:node => self, :section => sec) end end |
#partial_for ⇒ Object
Computes the name of the partial used to render this object in the sitemap.
41 42 43 |
# File 'lib/cms/addressable.rb', line 41 def partial_for self.class.name.demodulize.underscore end |