Class: RenderTreeHelper::Render

Inherits:
Object
  • Object
show all
Defined in:
app/helpers/render_tree_helper.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.hObject

Returns the value of attribute h.



12
13
14
# File 'app/helpers/render_tree_helper.rb', line 12

def h
  @h
end

.optionsObject

Returns the value of attribute options.



12
13
14
# File 'app/helpers/render_tree_helper.rb', line 12

def options
  @options
end

Class Method Details

.childrenObject



37
38
39
40
41
# File 'app/helpers/render_tree_helper.rb', line 37

def children
  unless options[:children].blank?
    "<ol>#{ options[:children] }</ol>"
  end
end

.render_node(h, options) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/helpers/render_tree_helper.rb', line 14

def render_node(h, options)
  @h, @options = h, options

  node = options[:node]
  "
    <li>
      <div class='item'>
        #{ show_link }
      </div>
      #{ children }
    </li>
  "
end


28
29
30
31
32
33
34
35
# File 'app/helpers/render_tree_helper.rb', line 28

def show_link
  node = options[:node]
  ns   = options[:namespace]
  url  = h.url_for(ns + [node])
  title_field = node[:name]

  "<h4>#{ h.link_to(title_field, url) }</h4>"
end