Sha256: ec12c5f46bdf3bc08c1b40d02e69cb73509966e758ece8dda585c1dea0ec9186
Contents?: true
Size: 1.09 KB
Versions: 31
Compression:
Stored size: 1.09 KB
Contents
module PublishMyData module ResourceRendering extend ActiveSupport::Concern included do private def render_resource(resource) resource.eager_load! render template: template_for_resource(resource), locals: locals_for_resource(resource) end def template_for_resource(resource) { Dataset => 'publish_my_data/datasets/show', Ontology => 'publish_my_data/ontologies/show', ConceptScheme => 'publish_my_data/concept_schemes/show', OntologyClass => 'publish_my_data/classes/show', Property => 'publish_my_data/properties/show', Concept => 'publish_my_data/concepts/show', Resource => 'publish_my_data/resources/show', ThirdParty::Ontology => 'publish_my_data/ontologies/show', ThirdParty::ConceptScheme => 'publish_my_data/concept_schemes/show' }[resource.class] end def locals_for_resource(resource) key = resource.class.name.demodulize.underscore.to_sym {key => resource} end end end end
Version data entries
31 entries across 31 versions & 1 rubygems