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
28
29
30
|
# File 'app/models/katalyst/content/figure.rb', line 28
def self.permitted_params
super - %i[heading_style] + %i[image caption]
end
|
Instance Method Details
#initialize_dup(source) ⇒ Object
17
18
19
20
21
22
23
24
25
26
|
# File 'app/models/katalyst/content/figure.rb', line 17
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
34
35
36
37
38
|
# File 'app/models/katalyst/content/figure.rb', line 34
def to_plain_text
text = ["Image: #{alt}"]
text << "Caption: #{caption}" if caption.present?
text.compact.join("\n") if visible?
end
|