Module: BlueberryCMS::PagesHelper

Defined in:
app/helpers/blueberry_cms/pages_helper.rb

Instance Method Summary collapse

Instance Method Details

#block_visible?(object) ⇒ Boolean

Returns:

  • (Boolean)


3
4
5
# File 'app/helpers/blueberry_cms/pages_helper.rb', line 3

def block_visible?(object)
  object.new_record? || object.errors.any?
end

#nested_set_options(klass, current_page = nil) ⇒ Object



7
8
9
10
11
12
13
# File 'app/helpers/blueberry_cms/pages_helper.rb', line 7

def nested_set_options(klass, current_page = nil)
  @cache ||= {}
  @cache[klass] ||= klass.traverse(:depth_first)
  @cache[klass].map do |page|
    ["#{'' * page.depth} #{page.name}", page.id, disabled: page == current_page ]
  end
end