Class: Demos::Forum::FileBlock

Inherits:
Hokusai::Block show all
Defined in:
ui/examples/forum/file.rb

Instance Attribute Summary

Attributes inherited from Hokusai::Block

#node, #provides, #publisher

Instance Method Summary collapse

Methods inherited from Hokusai::Block

#children, #children?, compile, computed, computed!, #draw, #draw_with, #dump, #emit, #initialize, inject, inject!, #method_missing, mount, #on_resize, provide, provides, #render, style, styles_get, template, template_from_file, template_get, #update, use, uses

Constructor Details

This class inherits a constructor from Hokusai::Block

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Hokusai::Block

Instance Method Details

#compute_backgroundObject



37
38
39
# File 'ui/examples/forum/file.rb', line 37

def compute_background
  index.odd? ? nil : Hokusai::Color.new(255, 255, 255,20)
end

#item_imageObject



41
42
43
44
45
46
47
48
49
50
# File 'ui/examples/forum/file.rb', line 41

def item_image
  asset = {
    audio: "audio-x-generic.png",
    image: "image-x-generic.png",
    app: "package-x-generic.png",
    video: "video-x-generic.png",
  }[item.type] || "text-x-generic.png"

  "#{__dir__}/../assets/icons/#{asset}"
end