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("↑", left_admin_section_page_path(parent, node), node.left_sibling) result << tree_nav_link("↓", right_admin_section_page_path(parent, node), node.right_sibling) result << tree_nav_link("→", down_admin_section_page_path(parent, node), node.left_sibling) result << tree_nav_link("←", 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