Class: Voom::Presenters::DSL::Components::ImageList

Inherits:
Base
  • Object
show all
Defined in:
lib/voom/presenters/dsl/components/image_list.rb

Defined Under Namespace

Classes: ImageListItem

Instance Attribute Summary collapse

Attributes inherited from Base

#attributes, #css_class, #draggable, #drop_zone, #id, #tag, #type

Instance Method Summary collapse

Methods inherited from Base

#expand!

Methods included from Pluggable

#include_plugins, #plugin, #plugin_module

Methods included from Mixins::YieldTo

#yield_to

Methods included from Serializer

#to_hash

Methods included from Lockable

#locked?

Constructor Details

#initialize(**attribs_, &block) ⇒ ImageList

Returns a new instance of ImageList.



9
10
11
12
13
14
15
16
17
# File 'lib/voom/presenters/dsl/components/image_list.rb', line 9

def initialize(**attribs_, &block)
  super(type: :image_list, **attribs_, &block)
  @images = []
  @columns = attribs_.delete(:columns){ 5 }
  @list_type = attribs_.delete(:list_type){ 'standard' }
  @spacing = attribs_.delete(:spacing)
  @border_attribs = attribs_.slice(:border, :border_color, :border_radius)
  expand!
end

Instance Attribute Details

#columnsObject (readonly)

Returns the value of attribute columns.



7
8
9
# File 'lib/voom/presenters/dsl/components/image_list.rb', line 7

def columns
  @columns
end

#imagesObject (readonly)

Returns the value of attribute images.



7
8
9
# File 'lib/voom/presenters/dsl/components/image_list.rb', line 7

def images
  @images
end

#list_typeObject (readonly)

Returns the value of attribute list_type.



7
8
9
# File 'lib/voom/presenters/dsl/components/image_list.rb', line 7

def list_type
  @list_type
end

#spacingObject (readonly)

Returns the value of attribute spacing.



7
8
9
# File 'lib/voom/presenters/dsl/components/image_list.rb', line 7

def spacing
  @spacing
end

Instance Method Details

#image(image = nil, **attribs, &block) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/voom/presenters/dsl/components/image_list.rb', line 19

def image(image=nil, **attribs, &block)
  combined_attribs = attribs.merge(@border_attribs)
  @images << ImageListItem.new(parent: self,
                               image: image,
                               **combined_attribs,
                               &block)
end