Class: Alchemy::EssencePicture

Inherits:
BaseRecord
  • Object
show all
Includes:
PictureThumbnails
Defined in:
app/models/alchemy/essence_picture.rb

Instance Method Summary collapse

Methods included from PictureThumbnails

#allow_image_cropping?, #image_cropper_settings, #picture_url, #picture_url_options, #thumbnail_url, #thumbnail_url_options

Instance Method Details

#preview_text(max = 30) ⇒ String

The name of the picture used as preview text in element editor views.

Parameters:

  • max (Integer) (defaults to: 30)

    The maximum length of the text returned.

Returns:

  • (String)

45
46
47
48
49
# File 'app/models/alchemy/essence_picture.rb', line 45

def preview_text(max = 30)
  return "" if picture.nil?

  picture.name.to_s[0..max - 1]
end

#serialized_ingredientString

Returns a serialized ingredient value for json api

Returns:

  • (String)

54
55
56
# File 'app/models/alchemy/essence_picture.rb', line 54

def serialized_ingredient
  picture_url(content.settings)
end