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.
12 13 14 15 16 17 |
# File 'lib/cms/addressable.rb', line 12 def ancestors(={}) ancestor_nodes = node.ancestors ancestors = ancestor_nodes.collect { |node| node.node } ancestors << self if [:include_self] ancestors end |
#cache_parent(section) ⇒ Object
24 25 26 |
# File 'lib/cms/addressable.rb', line 24 def cache_parent(section) @parent = section end |
#parent ⇒ Object
19 20 21 22 |
# File 'lib/cms/addressable.rb', line 19 def parent @parent if @parent node ? node.section : nil end |
#parent=(sec) ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/cms/addressable.rb', line 28 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.
37 38 39 |
# File 'lib/cms/addressable.rb', line 37 def partial_for self.class.name.demodulize.underscore end |