Sha256: 65ae5542f33c73654696fe62586fd0750b169379a9e25e13308e27d7cb2f8ee5
Contents?: true
Size: 1.01 KB
Versions: 12
Compression:
Stored size: 1.01 KB
Contents
# DOC: # We use Helper Methods for tree building, # because it's faster than View Templates and Partials # SECURITY note # Prepare your data on server side for rendering # or use h.html_escape(node.content) # for escape potentially dangerous content module RenderTreeHelper class Render class << self attr_accessor :h, :options def render_node(h, options) @h, @options = h, options node = options[:node] " <li> <div class='item'> #{ show_link } </div> #{ children } </li> " end def show_link node = options[:node] ns = options[:namespace] url = h.url_for(ns + [node]) title_field = options[:title] "<h4>#{ h.link_to(node.send(title_field), url) }</h4>" end def children unless options[:children].blank? "<ol>#{ options[:children] }</ol>" end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems