Sha256: 355637f98ee0a751398e4c9a331bf4eb5cd5443b2716f5055133c320079f8f35
Contents?: true
Size: 689 Bytes
Versions: 12
Compression:
Stored size: 689 Bytes
Contents
description 'Tree Viewer' dependencies 'aspects', 'utils/assets', 'misc/variables' export_scripts '*.js', '*.css' export_assets 'images/*' Aspects::Aspect.create(:treeview, hidden: true, cacheable: true, mime: 'application/json; charset=utf-8') do def call(context, page) # Format [[has-children, classes, path, name], ...] # Example: [[0, 'file-type-pdf', '/a/b.pdf', 'b.pdf'], ...] MultiJson.dump(page.children.map do |child| classes = child.children.empty? ? 'page' : 'folder' classes << " file-type-#{child.extension.downcase}" if !child.extension.empty? [child.children.empty? ? 0 : 1, classes, build_path(child), child.name] end) end end
Version data entries
12 entries across 12 versions & 1 rubygems