Sha256: e2a6c04cb505fc8f0f69b1dde96d3622b7ff7009536236cad830c4f01876a00e

Contents?: true

Size: 982 Bytes

Versions: 19

Compression:

Stored size: 982 Bytes

Contents

module Ckeditor
  module Orm
    module Base
      module AssetBase
        module InstanceMethods
          def filename
            data_file_name
          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

19 entries across 19 versions & 3 rubygems

Version Path
glebtv-ckeditor-4.0.2.7 lib/ckeditor/orm/base.rb
glebtv-ckeditor-4.0.2.6 lib/ckeditor/orm/base.rb
glebtv-ckeditor-4.0.2.5 lib/ckeditor/orm/base.rb
glebtv-ckeditor-4.0.2.4 lib/ckeditor/orm/base.rb
glebtv-ckeditor-4.0.2.2 lib/ckeditor/orm/base.rb
glebtv-ckeditor-4.0.2.1 lib/ckeditor/orm/base.rb
glebtv-ckeditor-4.0.2 lib/ckeditor/orm/base.rb
glebtv-ckeditor-4.0.1 lib/ckeditor/orm/base.rb
lafeber_ckeditor-3.7.3 lib/ckeditor/orm/base.rb
ckeditor-3.7.3 lib/ckeditor/orm/base.rb
ckeditor-3.7.2 lib/ckeditor/orm/base.rb
ckeditor-3.7.1 lib/ckeditor/orm/base.rb
ckeditor-3.7.0 lib/ckeditor/orm/base.rb
ckeditor-3.7.0.rc3 lib/ckeditor/orm/base.rb
ckeditor-3.7.0.rc2 lib/ckeditor/orm/base.rb
ckeditor-3.7.0.rc1 lib/ckeditor/orm/base.rb
ckeditor-3.6.3 lib/ckeditor/orm/base.rb
ckeditor-3.6.2 lib/ckeditor/orm/base.rb
ckeditor-3.6.1 lib/ckeditor/orm/base.rb