Skip to content

Commit bfa53c4

Browse files
authored
🐛 Use configured class instead of hard-coded (#6717)
The baseline configuration for the `Hyrax::PcdmMemberPresenterFactory` allows for us to specify the `file_presenter_class` and the `work_presenter_class`. However, in the case of `presenter_for` we were not leveraging that configurability. This commit rectifies that behavior. Tagging along with this commit is a minor performance improvement. Namely, check a simple boolean before we begin checking elements that might require additional queries and/or loading additional objects.
1 parent 2b3854f commit bfa53c4

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

app/presenters/hyrax/pcdm_member_presenter_factory.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ def work_presenters
9898
def presenter_for(document:, ability:)
9999
case document['has_model_ssim'].first
100100
when *Hyrax::ModelRegistry.file_set_rdf_representations
101-
Hyrax::FileSetPresenter.new(document, ability)
101+
file_presenter_class.new(document, ability)
102102
else
103-
Hyrax::WorkShowPresenter.new(document, ability)
103+
work_presenter_class.new(document, ability)
104104
end
105105
end
106106

app/presenters/hyrax/work_show_presenter.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ def download_url
6363

6464
# @return [Boolean] render a IIIF viewer
6565
def iiif_viewer?
66-
representative_id.present? &&
66+
Hyrax.config.iiif_image_server? &&
67+
representative_id.present? &&
6768
representative_presenter.present? &&
6869
representative_presenter.image? &&
69-
Hyrax.config.iiif_image_server? &&
7070
members_include_viewable_image?
7171
end
7272

0 commit comments

Comments
 (0)