Sha256: d5d69906bd78dc232fc683b526011fc6c055482239bc56d2a42f5f9b69322c68

Contents?: true

Size: 852 Bytes

Versions: 1

Compression:

Stored size: 852 Bytes

Contents

ActiveFedora::Datastream.class_eval do

  def safe_pid
    pid.sub(/:/, "-")
  end

  def active?
    dsState == 'A'
  end

  def current_version?
    @current_version ||= (new? || versions.empty? || dsVersionID == versions.first.dsVersionID)
  end

  def content_is_url?
    external? || redirect?
  end

  def content_is_downloadable?
    has_content? && (managed? || inline?)
  end

  def modifiable?
    !FcrepoAdmin.read_only && active? && current_version?
  end

  def content_is_uploadable?
    modifiable? && (managed? || inline?)
  end

  def content_is_editable?
    modifiable? && !content_is_url? && content_is_text? && dsSize <= FcrepoAdmin.max_editable_datastream_size
  end

  def content_is_text?
    has_content? && !mimeType.blank? && (mimeType.start_with?('text/') || FcrepoAdmin.extra_text_mime_types.include?(mimeType))
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fcrepo_admin-0.6.1 lib/fcrepo_admin/decorators/active_fedora/datastream_decorator.rb