Module: IiifPrint::IiifManifestPresenterBehavior::DisplayImagePresenterBehavior
- Defined in:
- app/presenters/iiif_print/iiif_manifest_presenter_behavior.rb
Overview
OVERRIDE: Hyrax v3.x
Instance Attribute Summary collapse
-
#base_url ⇒ Object
Extending the presenter to the base url which includes the protocol.
Instance Method Summary collapse
-
#ability ⇒ Object
Extending this class because there is an #ability= but not #ability and this definition mirrors the Hyrax::IiifManifestPresenter#ability.
-
#display_content ⇒ Object
OVERRIDE: IIIF Hyrax AV v0.2 #display_content for prez 3 manifests.
- #display_image ⇒ Object
- #display_image_url(base_url) ⇒ Object
- #hostname ⇒ Object
- #iiif_endpoint(file_id, base_url: request.base_url) ⇒ Object
-
#work? ⇒ Boolean
False.
Instance Attribute Details
#base_url ⇒ Object
Extending the presenter to the base url which includes the protocol. We need the base url to render the facet links and normalize the interface.
38 39 40 |
# File 'app/presenters/iiif_print/iiif_manifest_presenter_behavior.rb', line 38 def base_url @base_url end |
Instance Method Details
#ability ⇒ Object
Extending this class because there is an #ability= but not #ability and this definition mirrors the Hyrax::IiifManifestPresenter#ability.
42 43 44 |
# File 'app/presenters/iiif_print/iiif_manifest_presenter_behavior.rb', line 42 def ability @ability ||= NullAbility.new end |
#display_content ⇒ Object
OVERRIDE: IIIF Hyrax AV v0.2 #display_content for prez 3 manifests
60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'app/presenters/iiif_print/iiif_manifest_presenter_behavior.rb', line 60 def display_content return nil unless latest_file_id return super unless model.image? IIIFManifest::V3::DisplayContent .new(display_image_url(hostname), format: image_format(alpha_channels), width: width, height: height, type: 'Image', iiif_endpoint: iiif_endpoint(latest_file_id, base_url: hostname)) end |
#display_image ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'app/presenters/iiif_print/iiif_manifest_presenter_behavior.rb', line 46 def display_image return nil unless latest_file_id return nil unless model.image? return nil unless IiifPrint.config.default_iiif_manifest_version == 2 IIIFManifest::DisplayImage .new(display_image_url(hostname), format: image_format(alpha_channels), width: width, height: height, iiif_endpoint: iiif_endpoint(latest_file_id, base_url: hostname)) end |
#display_image_url(base_url) ⇒ Object
73 74 75 76 77 78 79 80 |
# File 'app/presenters/iiif_print/iiif_manifest_presenter_behavior.rb', line 73 def display_image_url(base_url) if ENV['EXTERNAL_IIIF_URL'].present? # At the moment we are only concerned about Hyrax's default image url builder iiif_image_url_builder(url_builder: Hyrax.config.iiif_image_url_builder) else super end end |
#hostname ⇒ Object
93 94 95 |
# File 'app/presenters/iiif_print/iiif_manifest_presenter_behavior.rb', line 93 def hostname @hostname || 'localhost' end |
#iiif_endpoint(file_id, base_url: request.base_url) ⇒ Object
82 83 84 85 86 87 88 89 90 91 |
# File 'app/presenters/iiif_print/iiif_manifest_presenter_behavior.rb', line 82 def iiif_endpoint(file_id, base_url: request.base_url) if ENV['EXTERNAL_IIIF_URL'].present? IIIFManifest::IIIFEndpoint.new( File.join(ENV['EXTERNAL_IIIF_URL'], file_id), profile: Hyrax.config.iiif_image_compliance_level_uri ) else super end end |
#work? ⇒ Boolean
Returns false.
99 100 101 |
# File 'app/presenters/iiif_print/iiif_manifest_presenter_behavior.rb', line 99 def work? false end |