Created
August 22, 2018 15:12
-
-
Save mankind/54c652f3d741528056912e5e65c801e5 to your computer and use it in GitHub Desktop.
attempt to use custom attribute renderere to display samvera active_fedora multi-part metadata json field
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
<%= presenter.attribute_to_html(:creator, render_as: :creator) %> |
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
require 'json' | |
module Hyrax | |
module Renderers | |
class CreatorAttributeRenderer < AttributeRenderer | |
def attribute_value_to_html(value) | |
new_value = JSON.parse(value) | |
new_value.each do |hash| | |
%(<span itemprop="creator> <a href="creator: #{value}"> ubiquity #{hash['creator_given_name']} ( #{hash['creator_orcid']} ) </a> </span>) | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment