Sha256: 27a6b9430fce56638ec2940a1c24a63f50d8698b0c319448a91f3d477191ee38

Contents?: true

Size: 986 Bytes

Versions: 4

Compression:

Stored size: 986 Bytes

Contents

module Spree
  class Image < Asset
    module Configuration
      module ActiveStorage
        extend ActiveSupport::Concern

        included do
          has_one_attached :attachment

          validates :attachment, attached: true, content_type: /\Aimage\/.*\z/

          default_scope { includes(attachment_attachment: :blob) }

          def self.styles
            @styles ||= {
              mini: '48x48>',
              small: '100x100>',
              product: '240x240>',
              pdp_thumbnail: '160x200>',
              plp_and_carousel: '448x600>',
              plp_and_carousel_xs: '254x340>',
              plp_and_carousel_sm: '350x468>',
              plp_and_carousel_md: '222x297>',
              plp_and_carousel_lg: '278x371>',
              large: '600x600>',
              plp: '278x371>',
              zoomed: '650x870>'
            }
          end

          def default_style
            :product
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
spree_core-4.4.1 app/models/spree/image/configuration/active_storage.rb
spree_core-4.4.0 app/models/spree/image/configuration/active_storage.rb
spree_core-4.4.0.rc2 app/models/spree/image/configuration/active_storage.rb
spree_core-4.4.0.rc1 app/models/spree/image/configuration/active_storage.rb