Class: Terrazzo::Field::RichText
- Inherits:
-
Base
- Object
- Base
- Terrazzo::Field::RichText
show all
- Defined in:
- lib/terrazzo/field/rich_text.rb
Constant Summary
Constants inherited
from Base
Base::ABSTRACT_FIELD_CLASSES
Instance Attribute Summary
Attributes inherited from Base
#attribute, #data, #options, #page, #resource
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
associative?, #field_type, field_type, #form_input_attributes, #initialize, permitted_attribute, #required?, #serializable_options, sortable?, transform_param, with_options
Class Method Details
.default_options ⇒ Object
24
25
26
|
# File 'lib/terrazzo/field/rich_text.rb', line 24
def default_options
{ truncate: 100 }
end
|
.eager_load? ⇒ Boolean
20
21
22
|
# File 'lib/terrazzo/field/rich_text.rb', line 20
def eager_load?
true
end
|
.searchable? ⇒ Boolean
16
17
18
|
# File 'lib/terrazzo/field/rich_text.rb', line 16
def searchable?
false
end
|
Instance Method Details
#serialize_value(mode) ⇒ Object
4
5
6
7
8
9
10
11
12
13
|
# File 'lib/terrazzo/field/rich_text.rb', line 4
def serialize_value(mode)
return nil if data.nil?
case mode
when :index
data.to_plain_text.truncate(options.fetch(:truncate, 100))
else
data.to_s
end
end
|