Class: Avo::Fields::LexxyField::EditComponent
- Inherits:
-
EditComponent
- Object
- EditComponent
- Avo::Fields::LexxyField::EditComponent
- Defined in:
- app/components/avo/fields/lexxy_field/edit_component.rb
Instance Method Summary collapse
- #editor_tag ⇒ Object
-
#media_library? ⇒ Boolean
A picked blob lands in the content as an attachment, so a field with attachments disabled has nowhere to put it.
- #media_library_path ⇒ Object
- #unique_id ⇒ Object
- #unique_selector ⇒ Object
Instance Method Details
#editor_tag ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'app/components/avo/fields/lexxy_field/edit_component.rb', line 4 def editor_tag if helpers.respond_to?(:lexxy_rich_textarea_tag) # Rails 8.0/8.1: the lexxy gem prepends its own tag helper. helpers.lexxy_rich_textarea_tag field_name, @field.value, else # Rails 8.2+: Action Text renders through the editor adapter, which the # lexxy gem registers as the default editor. helpers.rich_textarea_tag field_name, @field.value, end end |
#media_library? ⇒ Boolean
A picked blob lands in the content as an attachment, so a field with attachments disabled has nowhere to put it.
17 18 19 |
# File 'app/components/avo/fields/lexxy_field/edit_component.rb', line 17 def media_library? !@field. && Avo::MediaLibrary.configuration.visible? end |
#media_library_path ⇒ Object
21 22 23 24 25 26 |
# File 'app/components/avo/fields/lexxy_field/edit_component.rb', line 21 def media_library_path helpers.avo.attach_media_path( controller_selector: unique_selector, controller_name: "lexxy-field" ) end |
#unique_id ⇒ Object
28 29 30 |
# File 'app/components/avo/fields/lexxy_field/edit_component.rb', line 28 def unique_id @unique_id ||= "lexxy_#{@field.id}_#{SecureRandom.hex(4)}" end |
#unique_selector ⇒ Object
32 |
# File 'app/components/avo/fields/lexxy_field/edit_component.rb', line 32 def unique_selector = "[data-unique-selector=#{unique_id}]" |