Sha256: 052dd3ac057ed64f0f7cb086ba200486d1e6683bab9ef3cea4b3cc74bfb396bc

Contents?: true

Size: 849 Bytes

Versions: 3

Compression:

Stored size: 849 Bytes

Contents

module Admin
  module CategoriesHelper
  
    def render_cat hash, options = {}, &block
      sort_proc = options.delete :sort
      content_tag :tr, options do
        content_tag :td do
          hash.keys.sort_by(&sort_proc).each do |node|
            block.call node, render_tree(hash[node], :sort => sort_proc, &block)
          end
        end
      end if hash.present?
    end
  
    def display_node(node)
      html = ""
      if node.level
        html << "-" * node.level
      end
      html << " #{node.name}"
    end
  
    def display_sort_category_link(node)
      link_to(t('categories.links.sort'), sort_admin_category_path(node)) if node.children.size > 1
    end
  
    def display_edit_category_link(node)
      link_to(t('categories.links.edit'), edit_admin_category_path(node)) unless node.name == 'root'
    end
  
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
merrycms-0.1.2 app/helpers/admin/categories_helper.rb
merrycms-0.1.1 app/helpers/admin/categories_helper.rb
merrycms-0.1.0 app/helpers/admin/categories_helper.rb