Sha256: 38c7e61e5cca943f383b4979a0a067e99f8cbdd2696eb1b2980fbc7cb03ce9f7

Contents?: true

Size: 929 Bytes

Versions: 39

Compression:

Stored size: 929 Bytes

Contents

# frozen_string_literal: true

module Alchemy
  module Ingredients
    # 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
    #
    class Picture < Alchemy::Ingredient
      include Alchemy::PictureThumbnails

      store_accessor :data,
        :alt_tag,
        :caption,
        :crop_from,
        :crop_size,
        :css_class,
        :link_class_name,
        :link_target,
        :link_title,
        :link,
        :render_size,
        :title

      related_object_alias :picture, class_name: "Alchemy::Picture"

      # The first 30 characters of the pictures name
      #
      # Used by the Element#preview_text method.
      #
      # @param [Integer] max_length (30)
      #
      def preview_text(max_length = 30)
        picture&.name.to_s[0..max_length - 1]
      end
    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
alchemy_cms-6.1.10 app/models/alchemy/ingredients/picture.rb
alchemy_cms-6.1.9 app/models/alchemy/ingredients/picture.rb
alchemy_cms-6.1.8 app/models/alchemy/ingredients/picture.rb
alchemy_cms-6.1.7 app/models/alchemy/ingredients/picture.rb
alchemy_cms-6.1.6 app/models/alchemy/ingredients/picture.rb
alchemy_cms-6.1.5 app/models/alchemy/ingredients/picture.rb
alchemy_cms-6.0.14 app/models/alchemy/ingredients/picture.rb
alchemy_cms-6.1.4 app/models/alchemy/ingredients/picture.rb
alchemy_cms-6.0.13 app/models/alchemy/ingredients/picture.rb
alchemy_cms-6.1.3 app/models/alchemy/ingredients/picture.rb
alchemy_cms-6.1.2 app/models/alchemy/ingredients/picture.rb
alchemy_cms-6.1.1 app/models/alchemy/ingredients/picture.rb
alchemy_cms-6.1.0 app/models/alchemy/ingredients/picture.rb
alchemy_cms-6.0.12 app/models/alchemy/ingredients/picture.rb
alchemy_cms-6.0.11 app/models/alchemy/ingredients/picture.rb
alchemy_cms-6.0.10 app/models/alchemy/ingredients/picture.rb
alchemy_cms-6.0.9 app/models/alchemy/ingredients/picture.rb
alchemy_cms-6.0.8 app/models/alchemy/ingredients/picture.rb
alchemy_cms-6.0.7 app/models/alchemy/ingredients/picture.rb
alchemy_cms-6.0.6 app/models/alchemy/ingredients/picture.rb