Sha256: 5944caf114bc12f022fd3a540678468750b72f6736736b40c23cabfdb95ba8b8

Contents?: true

Size: 731 Bytes

Versions: 5

Compression:

Stored size: 731 Bytes

Contents

# encoding: utf-8

module Locomotive
  class ThemeAssetUploader < ::CarrierWave::Uploader::Base

    include Locomotive::CarrierWave::Uploader::Asset

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

    def extension_white_list
      %w(jpg jpeg gif png css js swf flv eot svg ttf woff woff2 otf ico htc map)
    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-3.0.0.rc6 app/uploaders/locomotive/theme_asset_uploader.rb
locomotivecms-3.0.0.rc5 app/uploaders/locomotive/theme_asset_uploader.rb
locomotivecms-3.0.0.rc4 app/uploaders/locomotive/theme_asset_uploader.rb
locomotivecms-3.0.0.rc3 app/uploaders/locomotive/theme_asset_uploader.rb
locomotivecms-3.0.0.rc2 app/uploaders/locomotive/theme_asset_uploader.rb