Sha256: 103944ba6521fd7dbd5e5e818971bda84405efa80cf23b224a6480cc9b8d6c41

Contents?: true

Size: 737 Bytes

Versions: 2

Compression:

Stored size: 737 Bytes

Contents

module Admin
  module CategoriesHelper
  
    def render_cat hash, options = {}, &block
      sort_proc = options.delete :sort
      hash.keys.sort_by(&sort_proc).each do |node|
        block.call node, render_tree(hash[node], :sort => sort_proc, &block)
      end
    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

2 entries across 2 versions & 1 rubygems

Version Path
merrycms-0.1.7 app/helpers/admin/categories_helper.rb
merrycms-0.1.4 app/helpers/admin/categories_helper.rb