Sha256: 0b37a4f202f66ef101e526f4490ce9c4a02181403930d56ef9541a616c543abf

Contents?: true

Size: 727 Bytes

Versions: 1

Compression:

Stored size: 727 Bytes

Contents

class Ckeditor::Picture < Ckeditor::Asset

  include Elasticsearch::Model
  include Elasticsearch::Model::Callbacks
  index_name 'ckeditor-assets'
  document_type 'asset'
  include Ckeditor::AssetSearch

  mount_uploader :data, Ckeditor::PictureUploader, mount_on: :data_file_name

  has_many :contents, foreign_key: :image_id, class_name: Georgia::Content

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

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

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

  def image?
    true
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
georgia-0.8.0 app/models/ckeditor/picture.rb