Method: PublishMyData::ResourcesHelper#resource_uri_or_label
- Defined in:
- app/helpers/publish_my_data/resources_helper.rb
#resource_uri_or_label(resource, term) ⇒ Object
uses eager loaded data to get the uri or label for a term
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'app/helpers/publish_my_data/resources_helper.rb', line 5 def resource_uri_or_label(resource, term) if term.try(:uri?) # if it's a RDF::URI it will respond to uri? with true res = resource.(term, PublishMyData::Resource) if res link_to((res.label || res.uri.to_s), resource_path_from_uri(res.uri)) else link_to term.to_s, resource_path_from_uri(term) end else term.to_s end end |