cirandas.net

ref: master

app/models/categories_block.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
class CategoriesBlock < Block

  CATEGORY_TYPES = {
    _('Generic category') => nil,
    _('Region') => 'Region',
    _('Product') => 'ProductCategory'
  }

  settings_items :category_types, :type => Array, :default => []

  attr_accessible :category_types

  def self.description
    _("Categories Menu")
  end

  def default_title
    _("Categories Menu")
  end

  def help
    _('This block presents the categories like a web site menu.')
  end

  def available_category_types
    CATEGORY_TYPES
  end

  def selected_categories
    Category.top_level_for(self.owner).from_types(self.category_types)
  end

  def self.expire_on
      { :profile => [], :environment => [:category] }
  end
end