-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix shared search links Fixes: * homepage `View All Collections` button * catalog Collection title links * catalog Work thumbnail links Activates: * catalog Collection thumbnail links * Fix links * Appease rubocop * Fix alignment * Use decorator instead of module_eval * Update app/helpers/blacklight/catalog_helper_behavior_decorator.rb Co-authored-by: Shana Moore <shana@scientist.com>
- Loading branch information
1 parent
0a6d047
commit 43f5d94
Showing
7 changed files
with
66 additions
and
8 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
app/helpers/blacklight/catalog_helper_behavior_decorator.rb
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,37 @@ | ||
# frozen_string_literal: true | ||
|
||
# OVERRIDE blacklight 6 to allow full url for show links for shared search thumbnail | ||
module Blacklight | ||
module CatalogHelperBehaviorDecorator | ||
def render_thumbnail_tag(document, image_options = {}, url_options = {}) | ||
value = if blacklight_config.view_config(document_index_view_type).thumbnail_method | ||
send(blacklight_config.view_config(document_index_view_type).thumbnail_method, document, image_options) | ||
elsif blacklight_config.view_config(document_index_view_type).thumbnail_field | ||
url = thumbnail_url(document) | ||
image_tag url, image_options if url.present? | ||
end | ||
|
||
# rubocop:disable Style/GuardClause | ||
if value | ||
if url_options == false | ||
# rubocop:disable Metrics/LineLength | ||
Deprecation.warn(self, "passing false as the second argument to render_thumbnail_tag is deprecated. Use suppress_link: true instead. This behavior will be removed in Blacklight 7") | ||
# rubocop:enable Metrics/LineLength | ||
url_options = { suppress_link: true } | ||
end | ||
if url_options[:suppress_link] | ||
value | ||
elsif url_options[:full_url] | ||
link_to generate_work_url(document.to_h, request) do | ||
value | ||
end | ||
else | ||
link_to_document document, value, url_options | ||
end | ||
end | ||
# rubocop:enable Style/GuardClause | ||
end | ||
end | ||
end | ||
|
||
Blacklight::CatalogHelperBehavior.prepend(Blacklight::CatalogHelperBehaviorDecorator) |
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 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 @@ | ||
<div class="search-results-title-row"> | ||
<h4 class="search-result-title"><%= link_to document.title_or_label, generate_work_url(document.to_h, request) %></h4> | ||
<%= Hyrax::CollectionPresenter.new(document, current_ability).collection_type_badge %> | ||
</div> |
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,3 @@ | ||
<div class="col-md-2"> | ||
<%= render_thumbnail_tag document, {}, { full_url: true } %> | ||
</div> |
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,5 @@ | ||
<div class="col-md-2"> | ||
<div class="list-thumbnail"> | ||
<%= render_thumbnail_tag document, {}, {full_url: true} %> | ||
</div> | ||
</div> |
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