Sha256: 063f98e4d4eadd64320613be185dbf264bf74cf161cf743864da8b5a5312c1cd

Contents?: true

Size: 896 Bytes

Versions: 5

Compression:

Stored size: 896 Bytes

Contents

module AppFrame::TreeNavHelper
  def tree_nav(node)
    result = []
    result << tree_nav_link("&uarr;", left_admin_section_page_path(parent, node),  node.left_sibling)
    result << tree_nav_link("&darr;", right_admin_section_page_path(parent, node), node.right_sibling)
    result << tree_nav_link("&rarr;", down_admin_section_page_path(parent, node),  node.left_sibling)
    result << tree_nav_link("&larr;", up_admin_section_page_path(parent, node),    node.parent)
    result << link_to("Edit",   edit_admin_section_page_path(parent, node))
    yield result if block_given?
    result << link_to("Delete", admin_section_page_path(parent, node), :method => :delete)
    content_tag :span, result.join('').html_safe, :class => 'tree_nav'
  end
  
  def tree_nav_link(text, link, condition = true)
    condition ? link_to(text.html_safe, link) : content_tag(:span, text.html_safe)
  end
  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
app_frame-0.6.1 app/helpers/app_frame/tree_nav_helper.rb
app_frame-0.5.8 app/helpers/app_frame/tree_nav_helper.rb
app_frame-0.5.7 app/helpers/app_frame/tree_nav_helper.rb
app_frame-0.5.6 app/helpers/app_frame/tree_nav_helper.rb
app_frame-0.5.5 app/helpers/app_frame/tree_nav_helper.rb