Class: Ckeditor::Asset

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
Orm::ActiveRecord::AssetBase, Georgia::Concerns::Taggable, Georgia::Indexer
Defined in:
app/models/ckeditor/asset.rb

Direct Known Subclasses

AttachmentFile, Picture

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
}

Instance Method Summary collapse

Methods included from Georgia::Indexer

included

Instance Method Details

#extensionObject



31
32
33
# File 'app/models/ckeditor/asset.rb', line 31

def extension
  @extension ||= data_content_type.gsub(/.*\/(.*)/, '\1')
end

#to_jq_uploadObject



21
22
23
24
25
26
27
28
29
# File 'app/models/ckeditor/asset.rb', line 21

def to_jq_upload
  {
    "name" => read_attribute(:data),
    "size" => data.size,
    "url" => data.url,
    "delete_url" => media_path(id: id),
    "delete_type" => "DELETE"
  }
end