Class: Ckeditor::Picture

Inherits:
Asset
  • Object
show all
Defined in:
app/models/ckeditor/picture.rb

Constant Summary

Constants inherited from Asset

Asset::SIZE_RANGE

Instance Method Summary collapse

Methods inherited from Asset

#extension, #short_name, #to_jq_upload

Methods included from Georgia::Indexer::Adapter

included, load_extension

Instance Method Details

#featured?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'app/models/ckeditor/picture.rb', line 7

def featured?
  @featured ||= !contents_count.zero?
end

#filenameObject



15
16
17
18
19
20
21
22
# File 'app/models/ckeditor/picture.rb', line 15

def filename
  @filename ||=
    if defined?(Cloudinary)
      data_file_name.dup.gsub(/v\d{10}\/(.*)/, '\1') || data_file_name
    else
      data_file_name
    end
end

#pagesObject



11
12
13
# File 'app/models/ckeditor/picture.rb', line 11

def pages
  @pages ||= contents.map(&:contentable).map(&:page).compact.uniq
end