Class: Locomotive::ThemeAssetUploader
Class Method Summary
collapse
Instance Method Summary
collapse
#image?, #set_content_type_of_model, #set_size, #set_width_and_height
#build_store_dir, #to_label, #to_liquid
Class Method Details
.build(site, path) ⇒ Object
20
21
22
23
24
25
|
# File 'app/uploaders/locomotive/theme_asset_uploader.rb', line 20
def self.build(site, path)
asset = site.theme_assets.build(folder: File.dirname(path))
uploader = ThemeAssetUploader.new(asset)
uploader.retrieve_from_store!(File.basename(path))
uploader
end
|
.content_types ⇒ Object
27
28
29
30
31
32
|
# File 'app/uploaders/locomotive/theme_asset_uploader.rb', line 27
def self.content_types
list = super.clone
list.delete(:pdf)
list
end
|
.url_for(site, path) ⇒ Object
16
17
18
|
# File 'app/uploaders/locomotive/theme_asset_uploader.rb', line 16
def self.url_for(site, path)
build(site, path).url
end
|
Instance Method Details
#extension_white_list ⇒ Object
12
13
14
|
# File 'app/uploaders/locomotive/theme_asset_uploader.rb', line 12
def extension_white_list
%w(jpg jpeg gif png css js swf flv eot svg ttf woff otf ico htc)
end
|
#store_dir ⇒ Object
8
9
10
|
# File 'app/uploaders/locomotive/theme_asset_uploader.rb', line 8
def store_dir
self.build_store_dir('sites', model.site_id, 'theme', model.folder)
end
|