-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use view components for the thumbnails
This will assist in our move to blacklight 8. This also removes a interactive element that behaves like a link but wasn't accessible. Fixes #3798
- Loading branch information
Showing
11 changed files
with
24 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<% value = presenter.thumbnail.render(@image_options) %> | ||
|
||
<% if value %> | ||
<div class="document-thumbnail"> | ||
<%= helpers.link_to_document(presenter.document, value, 'aria-hidden': true, tabindex: -1, counter: @counter) %> | ||
<%= helpers.iiif_drag_n_drop(@document.iiif_manifest, position: 'top') if @document.iiif_manifest %> | ||
</div> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# frozen_string_literal: true | ||
|
||
class ThumbnailWithIiifComponent < Blacklight::Document::ThumbnailComponent | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,2 @@ | ||
<% | ||
counter = document_counter_with_offset(document_counter) | ||
options = { | ||
:counter => counter, | ||
:suppress_link => true | ||
} | ||
context_href = document_link_params(document, {:counter => counter}).dig(:data, :"context-href") | ||
presenter = document_presenter(document) | ||
%> | ||
|
||
<% if presenter.thumbnail.exists? && tn = presenter.thumbnail.thumbnail_tag({}, options) %> | ||
<div class="document-thumbnail"> | ||
<div class="cover-image-wrapper" data-target="<%= solr_document_path document %>" data-context-href="<%= context_href %>"> | ||
<%= tn %> | ||
</div> | ||
<%= iiif_drag_n_drop(document.iiif_manifest, position: 'top') if document.iiif_manifest %> | ||
</div> | ||
<% end %> | ||
<%= render ThumbnailWithIiifComponent.new(counter: document_counter_with_offset(document_counter), | ||
presenter: document_presenter(document)) %> |
12 changes: 5 additions & 7 deletions
12
app/views/catalog/thumbnails/_collection_thumbnail.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,9 @@ | ||
<% if document_index_view_type == :gallery %> | ||
<%= link_to document, tabindex: '-1' do %> | ||
<% if document.collection_members.present? && document.collection_members.first.image_urls(:large).present? %> | ||
<%= image_tag(document.collection_members.first.image_urls(:large).first, class: 'stacks-image', alt: '') %> | ||
<% else %> | ||
<%= content_tag(:span, class:"fake-cover", aria: { hidden: true }) do %> | ||
<%= content_tag(:div, document_presenter(document).heading, class: "fake-cover-text") %> | ||
<% end %> | ||
<% if document.collection_members.present? && document.collection_members.first.image_urls(:large).present? %> | ||
<%= image_tag(document.collection_members.first.image_urls(:large).first, class: 'stacks-image', alt: '') %> | ||
<% else %> | ||
<%= content_tag(:span, class:"fake-cover", aria: { hidden: true }) do %> | ||
<%= content_tag(:div, document_presenter(document).heading, class: "fake-cover-text") %> | ||
<% end %> | ||
<% end %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters