Sha256: d78cc28835c4a7949443e1350219055e21fcab101c6450bee1e4e4a0abe1ddab
Contents?: true
Size: 1.51 KB
Versions: 12
Compression:
Stored size: 1.51 KB
Contents
require 'mediashelf/active_fedora_helper' class DownloadsController < ApplicationController include MediaShelf::ActiveFedoraHelper include Hydra::RepositoryController helper :downloads # Note: Actual downloads are handled by the index method insead of the show method # in order to avoid ActionController being clever with the filenames/extensions/formats. # To download a datastream, pass the datastream id as ?document_id=#{dsid} in the url def index fedora_object = ActiveFedora::Base.load_instance(params[:asset_id]) if params[:download_id] @datastream = fedora_object.datastreams[params[:download_id]] send_data @datastream.content, :filename=>@datastream.label, :type=>@datastream.attributes["mimeType"] #send_data( Fedora::Repository.instance.fetch_custom(params[:document_id], "datastreams/#{datastream_id}/content") ) else @datastreams = downloadables( fedora_object ) end end # def show # puts "params: #{params.inspect}" # puts "Request: #{request.inspect}" # puts "Path: #{request.path}" # # datastream_id = File.basename(request.path) # respond_to do |format| # format.html { send_data( Fedora::Repository.instance.fetch_custom(params[:document_id], "datastreams/#{datastream_id}/content") ) } # format.pdf { send_data( Fedora::Repository.instance.fetch_custom(params[:document_id], "datastreams/#{datastream_id}/content") ) } # end # # end end
Version data entries
12 entries across 12 versions & 1 rubygems