Sha256: 839629056f8ab2d72c594df53d342ba7ae74742513eafb7a9a0358dfcde0ec59
Contents?: true
Size: 839 Bytes
Versions: 18
Compression:
Stored size: 839 Bytes
Contents
require_dependency "push_type/admin_controller" module PushType class TaxonomiesController < AdminController def index @taxonomies = PushType::Taxonomy.descendants end def show @terms = taxonomy.hash_tree.map { |parent, children| json_map(parent, children) } end private def initial_breadcrumb breadcrumbs.add 'Taxonomies', push_type.taxonomies_path end def taxonomy @taxonomy ||= PushType::Taxonomy.descendants.find { |t| t.name.underscore == params[:id] } end def json_map(parent, children) { id: parent.id, title: parent.title, slug: parent.slug, sort_order: parent.sort_order, parent_id: parent.parent_id, children: children.map { |p, c| json_map(p, c) } } end end end
Version data entries
18 entries across 18 versions & 1 rubygems