Module: BcmsSeoSitemap::Generator

Extended by:
Generator, Cms::MenuHelper
Included in:
Generator
Defined in:
lib/bcms_seo_sitemap/generator.rb

Instance Method Summary collapse

Instance Method Details

#depthObject

If depth has never been set, it returns nil



29
30
31
# File 'lib/bcms_seo_sitemap/generator.rb', line 29

def depth
  configuration.depth || 0
end

#depth=(new_depth) ⇒ Object

These setter and getter methods are probably not needed anymore. Access to Cms::Settings.bcms_seo_sitemap could be done directly from Cms::SitemapsController and that would probably be cleaner.

I’m keeping them here to keep the changes contained to this file only for now.



24
25
26
# File 'lib/bcms_seo_sitemap/generator.rb', line 24

def depth=(new_depth)
  configuration.depth = new_depth.to_i
end

#itemsObject



8
9
10
11
12
13
14
15
16
# File 'lib/bcms_seo_sitemap/generator.rb', line 8

def items
  options = {:page => Cms::Page.find_by_path('/'), :show_all_siblings => true}
  if configuration.depth && configuration.depth.nonzero?
    options.merge!({:depth => configuration.depth})
  end
  items = menu_items(options)
  return [] unless items
  items
end