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

Version Path
olelo-0.9.15 plugins/treeview/main.rb
olelo-0.9.14 plugins/treeview/main.rb
olelo-0.9.13 plugins/treeview/main.rb
olelo-0.9.12 plugins/treeview/main.rb
olelo-0.9.11 plugins/treeview/main.rb
olelo-0.9.10 plugins/treeview/main.rb
olelo-0.9.9 plugins/treeview/main.rb
olelo-0.9.8 plugins/treeview/main.rb
olelo-0.9.7 plugins/treeview/main.rb
olelo-0.9.6 plugins/treeview/main.rb
olelo-0.9.5 plugins/treeview/main.rb
olelo-0.9.4 plugins/treeview/main.rb