Sha256: 05087aa28eb2306303e38eb6fc5ff2eccaf39f86ebd358a85e97f22e5a61be72

Contents?: true

Size: 1013 Bytes

Versions: 35

Compression:

Stored size: 1013 Bytes

Contents

module Ckeditor
  module Orm
    module Base
      module AssetBase
        module InstanceMethods
          def filename
            data_file_name
          end

          def size
            data_file_size
          end

          def has_dimensions?
            respond_to?(:width) && respond_to?(:height)
          end

          def image?
            Ckeditor::IMAGE_TYPES.include?(data_content_type)
          end

          def format_created_at
            self.created_at.strftime("%d.%m.%Y")
          end

          def url_content
            url
          end

          def url_thumb
            url(:thumb)
          end

          def as_json_methods
            [:url_content, :url_thumb, :size, :filename, :format_created_at]
          end

          def as_json(options = nil)
            options = {
              :methods => as_json_methods,
              :root => "asset"
            }.merge(options || {})

            super options
          end
        end
      end
    end
  end
end

Version data entries

35 entries across 35 versions & 4 rubygems

Version Path
danabr75-ckeditor-4.1.6 lib/ckeditor/orm/base.rb
glebtv-ckeditor-4.6.0 lib/ckeditor/orm/base.rb
glebtv-ckeditor-4.5.10.3 lib/ckeditor/orm/base.rb
glebtv-ckeditor-4.5.10.2 lib/ckeditor/orm/base.rb
glebtv-ckeditor-4.5.10.1 lib/ckeditor/orm/base.rb
glebtv-ckeditor-4.5.7.1 lib/ckeditor/orm/base.rb
glebtv-ckeditor-4.5.7 lib/ckeditor/orm/base.rb
ckeditor_custom_controller-4.1.6 lib/ckeditor/orm/base.rb
ckeditor-4.1.6 lib/ckeditor/orm/base.rb
ckeditor-4.1.5 lib/ckeditor/orm/base.rb
ckeditor-4.1.4 lib/ckeditor/orm/base.rb
ckeditor-4.1.3 lib/ckeditor/orm/base.rb
glebtv-ckeditor-4.4.7.4 lib/ckeditor/orm/base.rb
ckeditor-4.1.2 lib/ckeditor/orm/base.rb
glebtv-ckeditor-4.4.7.3 lib/ckeditor/orm/base.rb
glebtv-ckeditor-4.4.7.2 lib/ckeditor/orm/base.rb
glebtv-ckeditor-4.4.7.1 lib/ckeditor/orm/base.rb
glebtv-ckeditor-4.4.7 lib/ckeditor/orm/base.rb
glebtv-ckeditor-4.4.6 lib/ckeditor/orm/base.rb
ckeditor-4.1.1 lib/ckeditor/orm/base.rb