Class: Smithy::Image

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
ContentBlocks::Model
Defined in:
app/models/smithy/image.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.content_block_descriptionObject



10
11
12
# File 'app/models/smithy/image.rb', line 10

def content_block_description
  "Images are primarily used for adding image-based content to your pages"
end

.image_scaling_optionsObject



14
15
16
17
18
19
# File 'app/models/smithy/image.rb', line 14

def image_scaling_options
  [
    ['Keep to Scale', ''],
    ['Force Exact Dimensions (this may crop the image)', '#']
  ]
end

Instance Method Details

#formatted_contentObject



22
23
24
# File 'app/models/smithy/image.rb', line 22

def formatted_content
  @formatted_content ||= markdown_formatter.render
end

#to_liquidObject



26
27
28
29
30
31
# File 'app/models/smithy/image.rb', line 26

def to_liquid
  attributes.tap do |a|
    a['asset'] = asset.to_liquid if asset.present?
    a['formatted_content'] = formatted_content
  end
end