Module: CommonwealthVlrEngine::DownloadsControllerBehavior
- Extended by:
- ActiveSupport::Concern
- Includes:
- Blacklight::Catalog, ApplicationHelper, Finder, Streaming, Zipline
- Included in:
- DownloadsController
- Defined in:
- app/controllers/concerns/commonwealth_vlr_engine/downloads_controller_behavior.rb
Instance Method Summary collapse
-
#show ⇒ Object
render a page/modal with license terms, download links, etc.
-
#trigger_download ⇒ Object
initiates the file download.
Methods included from Finder
#get_audio_files, #get_document_files, #get_ereader_files, #get_file_parent_object, #get_files, #get_first_audio_file, #get_first_document_file, #get_first_ereader_file, #get_first_image_file, #get_first_volume_object, #get_image_files, #get_next_audio_file, #get_next_document_file, #get_next_ereader_file, #get_next_image_file, #get_next_volume_object, #get_prev_audio_file, #get_prev_document_file, #get_prev_ereader_file, #get_prev_image_file, #get_prev_volume_object, #get_volume_objects, #get_volume_parent_object, #sort_files
Methods included from ApplicationHelper
#datastream_disseminator_url, #date_range_constraints_to_s, #get_image_metadata, #iiif_image_tag, #iiif_image_url, #iiif_square_img_path, #insert_google_analytics, #insert_opengraph_markup, #link_to_county_facet, #link_to_facet, #link_to_facets, #link_to_field, #osd_nav_images, #render_format, #render_format_index, #render_mobile_icon_tags, #render_object_icon_path
Methods included from Streaming
Instance Method Details
#show ⇒ Object
render a page/modal with license terms, download links, etc
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/controllers/concerns/commonwealth_vlr_engine/downloads_controller_behavior.rb', line 21 def show @doc_response, @document = fetch(params[:id]) if @document[:has_model_ssim].include? 'info:fedora/afmodel:Bplmodels_File' parent_response, @parent_document = fetch(parent_id(@document)) @object_profile = JSON.parse(@document['object_profile_ssm'].first) else @parent_document = @document @object_profile = nil end respond_to do |format| format.html # for users w/o JS format.js { render :layout => false } # download modal window end end |
#trigger_download ⇒ Object
initiates the file download
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'app/controllers/concerns/commonwealth_vlr_engine/downloads_controller_behavior.rb', line 38 def trigger_download response, @solr_document = fetch(params[:id]) if !@solr_document.to_h.empty? && params[:datastream_id] if @solr_document[:has_model_ssim].include? 'info:fedora/afmodel:Bplmodels_File' @object_id = parent_id(@solr_document) send_content elsif @solr_document[:has_model_ssim].include? 'info:fedora/afmodel:Bplmodels_ObjectBase' @file_list = get_image_files(params[:id]) if !@file_list.empty? @object_id = params[:id] send_zipped_content else not_found end else not_found end end end |