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
- #filled? ⇒ Boolean
- #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
31 32 33 34 35 36 37 |
# File 'app/models/iron/fields/rich_text_area.rb', line 31 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
21 22 23 24 25 26 27 28 29 |
# File 'app/models/iron/fields/rich_text_area.rb', line 21 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 |
#filled? ⇒ Boolean
11 |
# File 'app/models/iron/fields/rich_text_area.rb', line 11 def filled? = rich_text&.body.present? |
#searchable_text ⇒ Object
13 14 15 |
# File 'app/models/iron/fields/rich_text_area.rb', line 13 def searchable_text rich_text&.to_plain_text end |
#value ⇒ Object
17 18 19 |
# File 'app/models/iron/fields/rich_text_area.rb', line 17 def value rich_text&.to_s end |