Sha256: 6a6f7e9059f309720cdb3cb98ae534c5fd9daf2b032519a9debd616736932e15

Contents?: true

Size: 695 Bytes

Versions: 39

Compression:

Stored size: 695 Bytes

Contents

# frozen_string_literal: true

module Alchemy
  module Ingredients
    # A link to a file
    #
    # Attach Alchemy::Attachment into this ingredient
    #
    class File < Alchemy::Ingredient
      store_accessor :data,
        :css_class,
        :link_text,
        :title

      related_object_alias :attachment, class_name: "Alchemy::Attachment"

      delegate :name, to: :attachment, allow_nil: true

      # The first 30 characters of the attachments name
      #
      # Used by the Element#preview_text method.
      #
      # @param [Integer] max_length (30)
      #
      def preview_text(max_length = 30)
        attachment&.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.0.5 app/models/alchemy/ingredients/file.rb
alchemy_cms-6.0.4 app/models/alchemy/ingredients/file.rb
alchemy_cms-6.0.3 app/models/alchemy/ingredients/file.rb
alchemy_cms-6.0.2 app/models/alchemy/ingredients/file.rb
alchemy_cms-6.0.1 app/models/alchemy/ingredients/file.rb
alchemy_cms-6.0.0 app/models/alchemy/ingredients/file.rb
alchemy_cms-6.0.0.pre.rc7 app/models/alchemy/ingredients/file.rb
alchemy_cms-6.0.0.pre.rc6 app/models/alchemy/ingredients/file.rb
alchemy_cms-6.0.0.pre.rc5 app/models/alchemy/ingredients/file.rb
alchemy_cms-6.0.0.pre.rc4 app/models/alchemy/ingredients/file.rb
alchemy_cms-6.0.0.pre.rc3 app/models/alchemy/ingredients/file.rb
alchemy_cms-6.0.0.pre.rc2 app/models/alchemy/ingredients/file.rb
alchemy_cms-6.0.0.pre.rc1 app/models/alchemy/ingredients/file.rb
alchemy_cms-6.0.0.pre.b6 app/models/alchemy/ingredients/file.rb
alchemy_cms-6.0.0.pre.b5 app/models/alchemy/ingredients/file.rb
alchemy_cms-6.0.0.pre.b4 app/models/alchemy/ingredients/file.rb
alchemy_cms-6.0.0.b3 app/models/alchemy/ingredients/file.rb
alchemy_cms-6.0.0.b2 app/models/alchemy/ingredients/file.rb
alchemy_cms-6.0.0.b1 app/models/alchemy/ingredients/file.rb