Skip to content

Commit

Permalink
694 supplemental links (#705)
Browse files Browse the repository at this point in the history
* Changes this field to render a link rather than a facet.

* Overrides renderer file so that external link opens in new tab.

* Fixes ruby syntax that circle ci didn't like

* Gives renderer a variable.
  • Loading branch information
CB987 committed Jan 17, 2025
1 parent f6f6d40 commit 3209177
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
15 changes: 15 additions & 0 deletions app/renderers/hyrax/renderers/external_link_attribute_renderer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# <!-- Hyrax v5.0.1 Override: added functionality so that the external link opens in a new tab. -->
# frozen_string_literal: true
module Hyrax
module Renderers
class ExternalLinkAttributeRenderer < AttributeRenderer
private

def li_value(value)
auto_link(value, :urls, target: "_blank", rel: "noopener noreferrer") do |link|
"<span class='fa fa-external-link'></span>&nbsp;#{link}"
end
end
end
end
end
3 changes: 2 additions & 1 deletion app/views/hyrax/base/_attribute_rows.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Instead, they are hard coded here. We, in turn, have overridden this partial so we can institute our own choices/order. -->
<% generic_renderer = ::Hyrax::Renderers::AttributeRenderer %>
<% facet_renderer = ::Hyrax::Renderers::FacetedAttributeRenderer %>
<% external_link_renderer = ::Hyrax::Renderers::ExternalLinkAttributeRenderer %>
<% content_type_term = SelfDeposit::ContentTypesService.label(presenter.solr_document['emory_content_type_tesi']) %>
<!-- Persistent URL block start -->
<%= render 'purl', presenter: presenter %>
Expand Down Expand Up @@ -33,7 +34,7 @@
<%= facet_renderer.new(:sponsor, presenter.solr_document['sponsor_ssi'], {}).render_dl_row %>
<%= facet_renderer.new(:grant_agencies, presenter.solr_document['grant_agencies_ssim'], {}).render_dl_row %>
<%= generic_renderer.new(:grant_information, presenter.solr_document['grant_information_tesim'], {}).render_dl_row %>
<%= facet_renderer.new(:related_datasets, presenter.solr_document['related_datasets_ssim'], {}).render_dl_row %>
<%= external_link_renderer.new(:related_datasets, presenter.solr_document['related_datasets_ssim'], {}).render_dl_row %>
<%= presenter.attribute_to_html(:abstract, html_dl: true) %>
<%= generic_renderer.new(:author_notes, presenter.solr_document['author_notes_tesi'], {}).render_dl_row %>
<%= presenter.attribute_to_html(:keyword, render_as: :faceted, html_dl: true) %>
Expand Down

0 comments on commit 3209177

Please sign in to comment.