Class: Ckeditor::Asset
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Ckeditor::Asset
- Includes:
- AssetSearch, Orm::ActiveRecord::AssetBase, Elasticsearch::Model, Elasticsearch::Model::Callbacks
- Defined in:
- app/models/ckeditor/asset.rb
Direct Known Subclasses
Constant Summary collapse
- SIZE_RANGE =
{ '< 25 KB' => 0..25, '25 KB to 100 KB' => 25..100, '100 KB to 500 KB' => 100..500, '500 KB to 1 MB' => 500..1000, '> 1 MB' => 1000..999999 }
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.policy_class ⇒ Object
45 46 47 |
# File 'app/models/ckeditor/asset.rb', line 45 def self.policy_class Georgia::MediaPolicy end |
Instance Method Details
#extension ⇒ Object
40 41 42 43 |
# File 'app/models/ckeditor/asset.rb', line 40 def extension self.data_content_type ||= self.data.file.content_type @extension ||= data_content_type.gsub(/.*\/(.*)/, '\1') end |
#image? ⇒ Boolean
49 50 51 |
# File 'app/models/ckeditor/asset.rb', line 49 def image? false end |
#short_name ⇒ Object
36 37 38 |
# File 'app/models/ckeditor/asset.rb', line 36 def short_name @short_name ||= self.data.file.filename.dup.gsub(/(.*)\.#{extension}/, '\1') if data.file and data.file.filename end |
#to_jq_upload ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'app/models/ckeditor/asset.rb', line 26 def to_jq_upload { "name" => read_attribute(:data), "size" => data.size, "url" => data.url, "delete_url" => media_path(id: id), "delete_type" => "DELETE" } end |