Module: CamaleonCms::Admin::CategoryHelper

Included in:
ApplicationHelper
Defined in:
app/helpers/camaleon_cms/admin/category_helper.rb

Overview

encoding: utf-8

Instance Method Summary collapse

Instance Method Details

#cama_category_get_options_html(categories, level = 0) ⇒ Object

build an array multiple with category items prefixed with - for each level categories: collection of categories level: internal iterator control



15
16
17
18
19
20
21
22
23
# File 'app/helpers/camaleon_cms/admin/category_helper.rb', line 15

def cama_category_get_options_html(categories, level = 0)
  options = []
  categories.all.decorate.each do |category|
    options << [(""*level) + category.the_title, category.id] unless @category.id == category.id
    children = category.children
    options += cama_category_get_options_html(children, level + 1) if children.size > 0
  end
  options
end