Class: Hyrax::DownloadsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Hyrax::DownloadsController
- Includes:
- Hydra::Controller::DownloadBehavior, LocalFileDownloadsControllerBehavior, StreamFileDownloadsControllerBehavior, ValkyrieDownloadsControllerBehavior, WorkflowsHelper
- Defined in:
- app/controllers/hyrax/downloads_controller.rb
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
-
#hydra_show_active_fedora_file ⇒ Object
We want to alias the show method for a later use with #show_active_fedora; because we’re adding quite a bit of logic and need a good alias.
-
#show ⇒ Object
Render the 404 page if the file doesn’t exist.
Methods included from WorkflowsHelper
Methods included from ValkyrieDownloadsControllerBehavior
Class Method Details
.default_content_path ⇒ Object
10 11 12 |
# File 'app/controllers/hyrax/downloads_controller.rb', line 10 def self.default_content_path :original_file end |
Instance Method Details
#hydra_show_active_fedora_file ⇒ Object
We want to alias the show method for a later use with #show_active_fedora; because we’re adding quite a bit of logic and need a good alias. Why the alias? Because we were using ‘super’ for the show method and that just doesn’t quite work with all of the antics we’re performing.
18 |
# File 'app/controllers/hyrax/downloads_controller.rb', line 18 alias hydra_show_active_fedora_file show |
#show ⇒ Object
Render the 404 page if the file doesn’t exist. Otherwise renders the file.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/controllers/hyrax/downloads_controller.rb', line 22 def show # We will use the thumbnail from our file system first, if one exists # Otherwise we will fallback to Valkyrie, then the default implementations use = params.fetch(:file, :original_file).to_sym if use == :thumbnail thumbnail = Hyrax::DerivativePath.derivative_path_for_reference(params[:id], 'thumbnail') if thumbnail.present? && File.exist?(thumbnail) @file = thumbnail return send_local_content end end return show_valkyrie if Hyrax.config.use_valkyrie? show_active_fedora end |