Class: Katalyst::Content::Figure
- Inherits:
-
Item
- Object
- ApplicationRecord
- Item
- Katalyst::Content::Figure
show all
- Defined in:
- app/models/katalyst/content/figure.rb
Instance Attribute Summary
Attributes inherited from Item
#children, #depth, #index, #parent
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Item
config, #heading_style_class, #layout?, #show_heading?
Class Method Details
.permitted_params ⇒ Object
26
27
28
|
# File 'app/models/katalyst/content/figure.rb', line 26
def self.permitted_params
super - %i[heading_style] + %i[image caption]
end
|
Instance Method Details
#initialize_dup(source) ⇒ Object
15
16
17
18
19
20
21
22
23
24
|
# File 'app/models/katalyst/content/figure.rb', line 15
def initialize_dup(source)
super
if source.attachment_changes["image"]
self.image = source.attachment_changes["image"].attachable
elsif source.image.attached? && !source.image.marked_for_destruction?
image.attach(source.image.blob)
end
end
|
#to_plain_text ⇒ Object
32
33
34
35
36
|
# File 'app/models/katalyst/content/figure.rb', line 32
def to_plain_text
text = ["Image: #{alt}"]
text << "Caption: #{caption}" if caption.present?
text.compact.join("\n") if visible?
end
|