Skip to content

Commit

Permalink
Generalize methods and language to IIIF viewer instead of UV
Browse files Browse the repository at this point in the history
  • Loading branch information
cjcolvar committed Oct 30, 2018
1 parent 5606b67 commit 659e90a
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 10 deletions.
7 changes: 5 additions & 2 deletions app/presenters/hyrax/work_show_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,18 @@ def download_url
Hyrax::Engine.routes.url_helpers.download_url(representative_presenter, host: request.host)
end

# @return [Boolean] render the UniversalViewer
def universal_viewer?
# @return [Boolean] render a IIIF viewer
def iiif_viewer?
representative_id.present? &&
representative_presenter.present? &&
representative_presenter.image? &&
Hyrax.config.iiif_image_server? &&
members_include_viewable_image?
end

alias universal_viewer? iiif_viewer?
deprecation_deprecate universal_viewer?: "use iiif_viewer? instead"

# Override this method to declare a different iiif viewer for your work type
# @return [Symbol] the name of the IIIF viewer partial to render
def iiif_viewer
Expand Down
4 changes: 2 additions & 2 deletions app/views/hyrax/base/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
<div class="panel-body">
<div class="row">
<%= render 'workflow_actions_widget', presenter: @presenter %>
<% if @presenter.universal_viewer? %>
<% if @presenter.iiif_viewer? %>
<div class="col-sm-12">
<%= render 'representative_media', presenter: @presenter, viewer: true %>
</div>
<% end %>
<div class="col-sm-3 text-center">
<%= render 'representative_media', presenter: @presenter, viewer: false unless @presenter.universal_viewer? %>
<%= render 'representative_media', presenter: @presenter, viewer: false unless @presenter.iiif_viewer? %>
<%= render 'citations', presenter: @presenter %>
<%= render 'social_media' %>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
# config.show_work_item_rows = 10

# Enable IIIF image service. This is required to use the
# UniversalViewer-ified show page
# IIIF viewer enabled show page
#
# If you have run the riiif generator, an embedded riiif service
# will be used to deliver images via IIIF. If you have not, you will
Expand Down
2 changes: 1 addition & 1 deletion lib/hyrax/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ def cache_path
end

# Enable IIIF image service. This is required to use the
# UniversalViewer-enabled show page
# IIIF viewer enabled show page
#
# If you have run the hyrax:riiif generator, an embedded riiif service
# will be used to deliver images via IIIF. If you have not, you will
Expand Down
4 changes: 2 additions & 2 deletions spec/presenters/hyrax/work_show_presenter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
it { is_expected.to eq 'http://example.org/concern/generic_works/888888/manifest' }
end

describe '#universal_viewer?' do
describe '#iiif_viewer?' do
let(:id_present) { false }
let(:representative_presenter) { double('representative', present?: false) }
let(:image_boolean) { false }
Expand All @@ -64,7 +64,7 @@
allow(Hyrax.config).to receive(:iiif_image_server?).and_return(iiif_enabled)
end

subject { presenter.universal_viewer? }
subject { presenter.iiif_viewer? }

context 'with no representative_id' do
it { is_expected.to be false }
Expand Down
4 changes: 2 additions & 2 deletions spec/views/hyrax/base/show.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@
expect(page).to have_content 'Foobar'
end

describe 'UniversalViewer integration' do
describe 'IIIF viewer integration' do
before do
allow(presenter).to receive(:universal_viewer?).and_return(viewer_enabled)
allow(presenter).to receive(:iiif_viewer?).and_return(viewer_enabled)
render template: 'hyrax/base/show.html.erb'
end

Expand Down

0 comments on commit 659e90a

Please sign in to comment.