Sha256: 264ec81d45413270db5145fd74163a62a6c02d658ed7907b1237b01a8918d9d0
Contents?: true
Size: 956 Bytes
Versions: 6
Compression:
Stored size: 956 Bytes
Contents
require 'mediashelf/active_fedora_helper' class GetController < ApplicationController include MediaShelf::ActiveFedoraHelper include Hydra::RepositoryController helper :downloads def show fedora_object = ActiveFedora::Base.load_instance(params[:id]) respond_to do |format| format.html { send_datastream downloadables( fedora_object, :canonical=>true ) } format.pdf { send_datastream downloadables( fedora_object, :canonical=>true, :mime_type=>"application/pdf" ) } format.jp2 do canonical_jp2 = downloadables( fedora_object, :canonical=>true, :mime_type=>"image/jp2" ) jp2_content_url = "#{canonical_jp2.url}/content" send_datastream canonical_jp2 end end end private def send_datastream(datastream) send_data datastream.content, :filename=>datastream.label, :type=>datastream.attributes["mimeType"] end end
Version data entries
6 entries across 6 versions & 1 rubygems