Class: Fields::RichTextArea
- Inherits:
-
Field
- Object
- Field
- Fields::RichTextArea
- Includes:
- ActionView::Helpers::TagHelper
- Defined in:
- app/models/iron/fields/rich_text_area.rb
Instance Method Summary collapse
- #content_value=(value) ⇒ Object
- #export_attachments ⇒ Object
- #export_value ⇒ Object
- #searchable_text ⇒ Object
- #value ⇒ Object
Instance Method Details
#content_value=(value) ⇒ Object
7 8 9 |
# File 'app/models/iron/fields/rich_text_area.rb', line 7 def content_value=(value) self.rich_text = value end |
#export_attachments ⇒ Object
29 30 31 32 33 34 35 |
# File 'app/models/iron/fields/rich_text_area.rb', line 29 def return [] unless rich_text&.body.present? rich_text.body.attachables.filter_map do |attachable| attachable.blob if attachable.respond_to?(:blob) end end |
#export_value ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'app/models/iron/fields/rich_text_area.rb', line 19 def export_value return { type: "rich_text_area", value: nil } unless rich_text&.body.present? html = rich_text.body. do || () end.to_html { type: "rich_text_area", value: html } end |
#searchable_text ⇒ Object
11 12 13 |
# File 'app/models/iron/fields/rich_text_area.rb', line 11 def searchable_text rich_text&.to_plain_text end |
#value ⇒ Object
15 16 17 |
# File 'app/models/iron/fields/rich_text_area.rb', line 15 def value rich_text&.to_s end |