Class: Voom::Presenters::DSL::Components::Card
- Includes:
- Mixins::Attaches, Mixins::Common, Mixins::DateTimeFields, Mixins::Icons, Mixins::Snackbars, Mixins::TextFields
- Defined in:
- lib/voom/presenters/dsl/components/card.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#components ⇒ Object
readonly
Returns the value of attribute components.
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#selected ⇒ Object
readonly
Returns the value of attribute selected.
-
#shows_errors ⇒ Object
readonly
Returns the value of attribute shows_errors.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Attributes inherited from EventBase
Attributes included from Mixins::Event
Attributes inherited from Base
#attributes, #context, #id, #type
Instance Method Summary collapse
- #actions(**attribs, &block) ⇒ Object
-
#initialize(**attribs_, &block) ⇒ Card
constructor
A new instance of Card.
- #media(**attribs, &block) ⇒ Object
- #text(*text, **attribs, &block) ⇒ Object
Methods included from Mixins::Snackbars
Methods included from Mixins::Icons
Methods included from Mixins::DateTimeFields
#date_field, #datetime_field, #time_field
Methods included from Mixins::TextFields
#hidden_field, #text_area, #text_field
Methods included from Mixins::Attaches
Methods included from Mixins::Common
#badge, #card, #form, #list, #table
Methods included from Mixins::Menus
Methods included from Mixins::Content
Methods included from Mixins::ExpansionPanels
Methods included from Mixins::Buttons
Methods included from Mixins::Grids
Methods included from Mixins::Typography
#body, #display, #headline, #subheading, #title
Methods included from Mixins::Append
Methods included from Mixins::Toggles
#checkbox, #icon_toggle, #radio_button, #switch
Methods included from Mixins::Event
Methods inherited from Base
Methods included from Mixins::YieldTo
Methods included from Serializer
Methods included from Lockable
Constructor Details
#initialize(**attribs_, &block) ⇒ Card
Returns a new instance of Card.
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/voom/presenters/dsl/components/card.rb', line 27 def initialize(**attribs_, &block) super(type: :card, **attribs_, &block) @height = attribs.delete(:height) @width = attribs.delete(:width) @selected = attribs.delete(:selected) {false} self.text(attribs.delete(:text)) if attribs.key?(:text) @shows_errors = attribs.delete(:shows_errors){true} @components = [] end |
Instance Attribute Details
#components ⇒ Object (readonly)
Returns the value of attribute components.
24 25 26 |
# File 'lib/voom/presenters/dsl/components/card.rb', line 24 def components @components end |
#height ⇒ Object (readonly)
Returns the value of attribute height.
24 25 26 |
# File 'lib/voom/presenters/dsl/components/card.rb', line 24 def height @height end |
#selected ⇒ Object (readonly)
Returns the value of attribute selected.
24 25 26 |
# File 'lib/voom/presenters/dsl/components/card.rb', line 24 def selected @selected end |
#shows_errors ⇒ Object (readonly)
Returns the value of attribute shows_errors.
24 25 26 |
# File 'lib/voom/presenters/dsl/components/card.rb', line 24 def shows_errors @shows_errors end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
24 25 26 |
# File 'lib/voom/presenters/dsl/components/card.rb', line 24 def width @width end |
Instance Method Details
#actions(**attribs, &block) ⇒ Object
95 96 97 98 99 100 |
# File 'lib/voom/presenters/dsl/components/card.rb', line 95 def actions(**attribs, &block) return @actions if locked? @actions = Actions.new(parent: self, context: context, **attribs, &block) end |
#media(**attribs, &block) ⇒ Object
39 40 41 42 43 44 |
# File 'lib/voom/presenters/dsl/components/card.rb', line 39 def media(**attribs, &block) return @media if locked? @media = Media.new(parent: self, context: context, **attribs, &block) end |
#text(*text, **attribs, &block) ⇒ Object
90 91 92 93 |
# File 'lib/voom/presenters/dsl/components/card.rb', line 90 def text(*text, **attribs, &block) self << Typography.new(type: :body, parent: self, text: text, context: context, **attribs, &block) end |