Class: Alchemy::Ingredients::Picture

Inherits:
Alchemy::Ingredient show all
Includes:
PictureThumbnails
Defined in:
app/models/alchemy/ingredients/picture.rb

Overview

A picture assignment

Assign Alchemy::Picture to this ingredient

Optionally you can add a link As well as set the alt tag, a caption and title

Instance Method Summary collapse

Methods included from PictureThumbnails

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

Methods inherited from Alchemy::Ingredient

#definition, #deprecated?, #essence, #has_hint?, #has_tinymce?, #has_validations?, normalize_type, #partial_name, #preview_ingredient?, related_object_alias, #settings, #settings_value, #to_partial_path, translated_label_for, #value

Methods included from Hints

#has_hint?, #hint

Instance Method Details

#preview_text(max_length = 30) ⇒ Object

The first 30 characters of the pictures name

Used by the Element#preview_text method.

Parameters:

  • max_length (Integer) (defaults to: 30)

    (30)



36
37
38
# File 'app/models/alchemy/ingredients/picture.rb', line 36

def preview_text(max_length = 30)
  picture&.name.to_s[0..max_length - 1]
end