Class: FlexiAdmin::Components::Shared::TrixComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- FlexiAdmin::Components::Shared::TrixComponent
- Defined in:
- lib/flexi_admin/components/shared/trix_component.rb
Instance Attribute Summary collapse
-
#attr_name ⇒ Object
readonly
Returns the value of attribute attr_name.
-
#disabled ⇒ Object
readonly
Returns the value of attribute disabled.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #element_id ⇒ Object
-
#initialize(attr_name:, value:, disabled: false) ⇒ TrixComponent
constructor
A new instance of TrixComponent.
- #short_text? ⇒ Boolean
Constructor Details
#initialize(attr_name:, value:, disabled: false) ⇒ TrixComponent
Returns a new instance of TrixComponent.
7 8 9 10 11 |
# File 'lib/flexi_admin/components/shared/trix_component.rb', line 7 def initialize(attr_name:, value:, disabled: false) @attr_name = attr_name @value = value @disabled = disabled end |
Instance Attribute Details
#attr_name ⇒ Object (readonly)
Returns the value of attribute attr_name.
5 6 7 |
# File 'lib/flexi_admin/components/shared/trix_component.rb', line 5 def attr_name @attr_name end |
#disabled ⇒ Object (readonly)
Returns the value of attribute disabled.
5 6 7 |
# File 'lib/flexi_admin/components/shared/trix_component.rb', line 5 def disabled @disabled end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
5 6 7 |
# File 'lib/flexi_admin/components/shared/trix_component.rb', line 5 def value @value end |
Instance Method Details
#element_id ⇒ Object
13 14 15 |
# File 'lib/flexi_admin/components/shared/trix_component.rb', line 13 def element_id "trix-input-#{@attr_name}" || SecureRandom.uuid end |
#short_text? ⇒ Boolean
17 18 19 |
# File 'lib/flexi_admin/components/shared/trix_component.rb', line 17 def short_text? value.present? && value.size < 150 end |