Module: Admin::CategoriesHelper

Defined in:
app/helpers/admin/categories_helper.rb

Instance Method Summary collapse

Instance Method Details



23
24
25
# File 'app/helpers/admin/categories_helper.rb', line 23

def display_edit_category_link(node)
  link_to(t('categories.links.edit'), edit_admin_category_path(node)) unless node.name == 'root'
end

#display_node(node) ⇒ Object



11
12
13
14
15
16
17
# File 'app/helpers/admin/categories_helper.rb', line 11

def display_node(node)
  html = ""
  if node.level
    html << "-" * node.level
  end
  html << " #{node.name}"
end


19
20
21
# File 'app/helpers/admin/categories_helper.rb', line 19

def display_sort_category_link(node)
  link_to(t('categories.links.sort'), sort_admin_category_path(node)) if node.children.size > 1
end

#render_cat(hash, options = {}, &block) ⇒ Object



4
5
6
7
8
9
# File 'app/helpers/admin/categories_helper.rb', line 4

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