Class: Voom::Presenters::DSL::Components::Card::Media

Inherits:
Base
  • Object
show all
Includes:
Mixins::Attaches, Mixins::Common
Defined in:
lib/voom/presenters/dsl/components/card.rb

Instance Attribute Summary collapse

Attributes inherited from Base

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

Instance Method Summary collapse

Methods included from Mixins::Common

#badge, #card, #form, #list, #table, #unordered_list

Methods included from Mixins::Tables

#table

Methods included from Mixins::Dialogs

#dialog

Methods included from Mixins::ImageLists

#image_list

Methods included from Mixins::Icons

#icon

Methods included from Mixins::TabBars

#tab_bar

Methods included from Mixins::Menus

#menu

Methods included from Mixins::Content

#content

Methods included from Mixins::ExpansionPanels

#expansion_panel

Methods included from Mixins::Grids

#grid

Methods included from Mixins::Typography

#blank, #body, #body2, #caption, #headline, #headline1, #headline2, #headline3, #headline4, #headline5, #headline6, #link, #overline, #page_title, #separator, #subtitle2, #text

Methods included from Mixins::Append

#<<, #yield_to

Methods included from Mixins::Toggles

#checkbox, #icon_toggle, #radio_button, #switch

Methods included from Mixins::Attaches

#attach

Methods included from Namespace

#_expand_namespace_

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) ⇒ Media

Returns a new instance of Media.



54
55
56
57
58
59
60
61
62
63
# File 'lib/voom/presenters/dsl/components/card.rb', line 54

def initialize(**attribs_, &block)
  super(type: :media, **attribs_, &block)
  @height = attribs.delete(:height)
  @width = attribs.delete(:width)
  @color = attribs.delete(:color)
  @hidden = attribs.delete(:hidden) {false}

  @components = []
  expand!
end

Instance Attribute Details

#colorObject (readonly)

Returns the value of attribute color.



52
53
54
# File 'lib/voom/presenters/dsl/components/card.rb', line 52

def color
  @color
end

#componentsObject (readonly)

Returns the value of attribute components.



52
53
54
# File 'lib/voom/presenters/dsl/components/card.rb', line 52

def components
  @components
end

#heightObject (readonly)

Returns the value of attribute height.



52
53
54
# File 'lib/voom/presenters/dsl/components/card.rb', line 52

def height
  @height
end

#hiddenObject (readonly)

Returns the value of attribute hidden.



52
53
54
# File 'lib/voom/presenters/dsl/components/card.rb', line 52

def hidden
  @hidden
end

#widthObject (readonly)

Returns the value of attribute width.



52
53
54
# File 'lib/voom/presenters/dsl/components/card.rb', line 52

def width
  @width
end

Instance Method Details

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



79
80
81
82
83
# File 'lib/voom/presenters/dsl/components/card.rb', line 79

def avatar(avatar = nil, **attribs, &block)
  return @avatar if locked?
  @avatar = Avatar.new(parent: self, avatar: avatar,
                       **attribs, &block)
end

#button(icon = nil, **attributes, &block) ⇒ Object



90
91
92
93
# File 'lib/voom/presenters/dsl/components/card.rb', line 90

def button(icon = nil, **attributes, &block)
  return @button if locked?
  @button = Components::Button.new(icon: icon, position: [:top, :right], parent: self, **attributes, &block)
end

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



85
86
87
88
# File 'lib/voom/presenters/dsl/components/card.rb', line 85

def image(image = nil, **attribs, &block)
  return @image if locked?
  @image = Image.new(parent: self, image: image, **attribs, &block)
end

#subtitle(*text, **attribs, &block) ⇒ Object



74
75
76
77
# File 'lib/voom/presenters/dsl/components/card.rb', line 74

def subtitle(*text, **attribs, &block)
  return @subtitle if locked?
  @subtitle = Components::Typography.new(parent: self, type: :subtitle, text: text, **attribs, &block)
end

#title(*title, **attribs, &block) ⇒ Object



65
66
67
68
69
70
71
72
# File 'lib/voom/presenters/dsl/components/card.rb', line 65

def title(*title, **attribs, &block)
  return @title if locked?
  @title = Typography.new(type: :headline,
                          level: 6,
                          parent: self,
                          text: title,
                          **attribs, &block)
end