13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'app/helpers/alacarte_helper.rb', line 13
def elements_for(, current_element)
result = ''
.items.each do |item|
if item.valid?
_html_options = item.html_options || {}
_html_options[:class] = _html_options[:class].to_s.insert(0, 'active ').strip if (current_element == item.as)
_item = case item.type
when :link
_path = item.path.respond_to?(:call) ? item.path.call : item.path
link_to(item.label.html_safe, _path, _html_options)
when :text
item.label.html_safe
else
content_tag(item.type, item.label, _html_options)
end
if item.items.size > 0
_item << elements_for(item, current_element)
end
result << content_tag(:li, _item, item.wrapper_options)
end
end
result.blank? ? '' : content_tag(:ul, result.html_safe, .group_options)
end
|