Sha256: 988859201fef9020c48932bb41973a1a0dbb210b3c908331ef999c4ef7b1c309

Contents?: true

Size: 664 Bytes

Versions: 39

Compression:

Stored size: 664 Bytes

Contents

module Locomotive
  module API
    module Entities

      class ThemeAssetEntity < BaseEntity

        expose :content_type, :local_path, :folder, :checksum

        expose :filename do |theme_asset, _|
          theme_asset.read_attribute(:source_filename)
        end

        expose :url do |theme_asset, _|
          theme_asset.source.url
        end

        expose :size, format_with: :human_size

        expose :width, if: :image?
        expose :height, if: :image?

        expose :raw_size do |theme_asset, _|
          theme_asset.size
        end

        private

        def image?
          object.image?
        end

      end

    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
locomotivecms-4.2.0.alpha2 app/api/locomotive/api/entities/theme_asset_entity.rb
locomotivecms-4.2.0.alpha1 app/api/locomotive/api/entities/theme_asset_entity.rb
locomotivecms-4.1.1 app/api/locomotive/api/entities/theme_asset_entity.rb
locomotivecms-4.1.0 app/api/locomotive/api/entities/theme_asset_entity.rb
locomotivecms-4.1.0.rc1 app/api/locomotive/api/entities/theme_asset_entity.rb
locomotivecms-4.0.3 app/api/locomotive/api/entities/theme_asset_entity.rb
locomotivecms-4.0.2 app/api/locomotive/api/entities/theme_asset_entity.rb
locomotivecms-4.0.1 app/api/locomotive/api/entities/theme_asset_entity.rb
locomotivecms-4.0.0 app/api/locomotive/api/entities/theme_asset_entity.rb
locomotivecms-4.0.0.rc0 app/api/locomotive/api/entities/theme_asset_entity.rb
locomotivecms-4.0.0.alpha3 app/api/locomotive/api/entities/theme_asset_entity.rb
locomotivecms-3.4.1 app/api/locomotive/api/entities/theme_asset_entity.rb
locomotivecms-4.0.0.alpha2 app/api/locomotive/api/entities/theme_asset_entity.rb
locomotivecms-4.0.0.alpha1 app/api/locomotive/api/entities/theme_asset_entity.rb
locomotivecms-3.4.0 app/api/locomotive/api/entities/theme_asset_entity.rb
locomotivecms-3.3.0 app/api/locomotive/api/entities/theme_asset_entity.rb
locomotivecms-3.3.0.rc3 app/api/locomotive/api/entities/theme_asset_entity.rb
locomotivecms-3.3.0.rc2 app/api/locomotive/api/entities/theme_asset_entity.rb
locomotivecms-3.1.2 app/api/locomotive/api/entities/theme_asset_entity.rb
locomotivecms-3.2.1 app/api/locomotive/api/entities/theme_asset_entity.rb