Module: FassetsCore::ApplicationHelper

Defined in:
app/helpers/fassets_core/application_helper.rb

Instance Method Summary collapse

Instance Method Details



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'app/helpers/fassets_core/application_helper.rb', line 24

def menutree_ol(acts_as_tree_set, init=true, &block)
  if acts_as_tree_set.size > 0
    if init
      ret = '<ol class="frame_menu">'
    else
      ret = '<ol>'
    end
    number = 1
    acts_as_tree_set.collect do |item|
      #next if item.parent_id && init
      ret += '<li id="'+item.position.to_s+'">'
      ret += yield item
      ret += menutree_ol(item.children, false, &block) if item.children.size > 0
      ret += '</li>'
      number += 1
    end
    ret += '</ol>'
  end
  unless ret == nil
    ret.html_safe
  end
end

#tree_ol(acts_as_tree_set, init = true, &block) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/helpers/fassets_core/application_helper.rb', line 3

def tree_ol(acts_as_tree_set, init=true, &block)
  if acts_as_tree_set.size > 0
    if init
      ret = '<ol class="sortable_frames">'
    else
      ret = '<ol>'
    end
    acts_as_tree_set.collect do |item|
      #next if item.parent_id && init
      ret += '<li id="frame_'+item.id.to_s+'" class="frame"><div>'
      ret += yield item
      ret += '</div>'
      ret += tree_ol(item.children, false, &block) if item.children.size > 0
      ret += '</li>'
    end
    ret += '</ol>'
  end
  unless ret == nil
    ret.html_safe
  end
end