Sha256: 7cb4f4a68c22860491dc253f13707975db0b64af309e5cafb877b23d479acb8f

Contents?: true

Size: 752 Bytes

Versions: 5

Compression:

Stored size: 752 Bytes

Contents

# encoding: utf-8

module Locomotive
  class ThemeAssetUploader < BaseUploader

    include Locomotive::CarrierWave::Uploader::Asset

    def store_dir
      self.build_store_dir('sites', model.site_id, 'theme', model.folder)
    end

    def extension_whitelist
      %w(jpg jpeg gif png css js swf flv mp4 eot svg svgz ttf ttc woff woff2 otf ico htc map html cur txt xml json ogv)
    end

    def apply_content_type_exception(value)
      if content_type == 'image/svg+xml' && model.folder.starts_with?('fonts')
        :font
      else
        value
      end
    end

    def self.content_types
      # pdf is not considered as a custom content type for theme assets.
      list = super.clone
      list.delete(:pdf)
      list
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
locomotivecms-4.0.3 app/uploaders/locomotive/theme_asset_uploader.rb
locomotivecms-4.0.2 app/uploaders/locomotive/theme_asset_uploader.rb
locomotivecms-4.0.1 app/uploaders/locomotive/theme_asset_uploader.rb
locomotivecms-4.0.0 app/uploaders/locomotive/theme_asset_uploader.rb
locomotivecms-4.0.0.rc0 app/uploaders/locomotive/theme_asset_uploader.rb