Sha256: 169b760572dcbe1dedd006c3ee321e2c67d62c8a064a9f44d6006467d7b4c430

Contents?: true

Size: 757 Bytes

Versions: 5

Compression:

Stored size: 757 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 webm)
    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.2.0.alpha2 app/uploaders/locomotive/theme_asset_uploader.rb
locomotivecms-4.2.0.alpha1 app/uploaders/locomotive/theme_asset_uploader.rb
locomotivecms-4.1.1 app/uploaders/locomotive/theme_asset_uploader.rb
locomotivecms-4.1.0 app/uploaders/locomotive/theme_asset_uploader.rb
locomotivecms-4.1.0.rc1 app/uploaders/locomotive/theme_asset_uploader.rb