Class: Avo::Resources::Controls::BaseControl
- Inherits:
-
Object
- Object
- Avo::Resources::Controls::BaseControl
- Defined in:
- lib/avo/resources/controls/base_control.rb
Direct Known Subclasses
ActionsList, AttachButton, BackButton, CreateButton, DeleteButton, DetachButton, EditButton, OrderControls, SaveButton, ShowButton
Constant Summary collapse
- CONTROL_OPTIONS =
Keys the control consumes itself, either as an option it renders from (
style,icon…) or as internal plumbing merged in byexecute_block(as_index_control,item…). Everything a user passes outside this list is forwarded to the rendered element as an HTML attribute, solink_to "Docs", url, rel: "noopener"reaches the<a>tag. %i[ label path title target data class style color size icon icon_class confirmation_message as_index_control from_custom_list item ].freeze
Instance Attribute Summary collapse
-
#as_index_control ⇒ Object
readonly
Returns the value of attribute as_index_control.
-
#color ⇒ Object
readonly
Returns the value of attribute color.
-
#confirmation_message ⇒ Object
readonly
Returns the value of attribute confirmation_message.
-
#icon ⇒ Object
readonly
Returns the value of attribute icon.
-
#icon_class ⇒ Object
readonly
Returns the value of attribute icon_class.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#style ⇒ Object
readonly
Returns the value of attribute style.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(**args) ⇒ BaseControl
constructor
A new instance of BaseControl.
- #type ⇒ Object
Constructor Details
#initialize(**args) ⇒ BaseControl
Returns a new instance of BaseControl.
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/avo/resources/controls/base_control.rb', line 20 def initialize(**args) @label = args[:label] @title = args[:title] @color = args[:color] || :gray @style = args[:style] || :text @icon = args[:icon] @icon_class = (@style == :icon) ? " text-gray-600 h-6 hover:text-gray-600" : "" @confirmation_message = args[:confirmation_message] @size = args[:size] || :md @as_index_control = args[:as_index_control] end |
Instance Attribute Details
#as_index_control ⇒ Object (readonly)
Returns the value of attribute as_index_control.
18 19 20 |
# File 'lib/avo/resources/controls/base_control.rb', line 18 def as_index_control @as_index_control end |
#color ⇒ Object (readonly)
Returns the value of attribute color.
18 19 20 |
# File 'lib/avo/resources/controls/base_control.rb', line 18 def color @color end |
#confirmation_message ⇒ Object (readonly)
Returns the value of attribute confirmation_message.
18 19 20 |
# File 'lib/avo/resources/controls/base_control.rb', line 18 def @confirmation_message end |
#icon ⇒ Object (readonly)
Returns the value of attribute icon.
18 19 20 |
# File 'lib/avo/resources/controls/base_control.rb', line 18 def icon @icon end |
#icon_class ⇒ Object (readonly)
Returns the value of attribute icon_class.
18 19 20 |
# File 'lib/avo/resources/controls/base_control.rb', line 18 def icon_class @icon_class end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
18 19 20 |
# File 'lib/avo/resources/controls/base_control.rb', line 18 def label @label end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
18 19 20 |
# File 'lib/avo/resources/controls/base_control.rb', line 18 def size @size end |
#style ⇒ Object (readonly)
Returns the value of attribute style.
18 19 20 |
# File 'lib/avo/resources/controls/base_control.rb', line 18 def style @style end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
18 19 20 |
# File 'lib/avo/resources/controls/base_control.rb', line 18 def title @title end |
Instance Method Details
#type ⇒ Object
32 33 34 |
# File 'lib/avo/resources/controls/base_control.rb', line 32 def type self.class.name.demodulize.underscore.to_sym end |