Sha256: 14058594e421f7ea8e43fbed454bbb548739ebe58a9a045b18b63be3f910b28b

Contents?: true

Size: 705 Bytes

Versions: 27

Compression:

Stored size: 705 Bytes

Contents

module Ddr
  module Models
    module HasThumbnail
      extend ActiveSupport::Concern
  
      included do
        has_file_datastream name: Ddr::Datastreams::THUMBNAIL, 
                            versionable: true, 
                            label: "Thumbnail for this object", 
                            control_group: 'M'
      end

      def thumbnail_changed?
        thumbnail.content_changed?
      end

      def copy_thumbnail_from(other)
        if other && other.has_thumbnail?
          self.thumbnail.content = other.thumbnail.content
          self.thumbnail.mimeType = other.thumbnail.mimeType if thumbnail_changed?
        end
        thumbnail_changed?
      end

    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
ddr-models-1.7.0 lib/ddr/models/has_thumbnail.rb
ddr-models-1.6.0 lib/ddr/models/has_thumbnail.rb
ddr-models-1.5.0 lib/ddr/models/has_thumbnail.rb
ddr-models-1.4.0 lib/ddr/models/has_thumbnail.rb
ddr-models-1.3.0 lib/ddr/models/has_thumbnail.rb
ddr-models-1.2.1 lib/ddr/models/has_thumbnail.rb
ddr-models-1.2.0 lib/ddr/models/has_thumbnail.rb