Skip to content

Instantly share code, notes, and snippets.

@mankind
Created August 22, 2018 15:12
Show Gist options
  • Save mankind/54c652f3d741528056912e5e65c801e5 to your computer and use it in GitHub Desktop.
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
<%= presenter.attribute_to_html(:creator, render_as: :creator) %>
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