i want create extension preview gtfs data - though question more how create extension preview data.
looking through documentation , code i've found.
and these examples of existing preview extension:
is there example of absolutely minimal extension previewing or tips on how go gtfs (what's best example base work off)?
i suggest have @ text preview extension. reasonably small , covers important parts such how let ckan know extension can preview file, how load templates, how load javascript , css , how use resource proxy (which there around same origin policy).
the current version of plugin in ckan uses feature allows defining how reasonable extension can preview files not available in older ckans.
there json preview extension in stable version 2.0 of ckan smaller text-preview , supports older ckans well.
a minimal preview plugin looks (without template):
import ckan.plugins p class preview(p.singletonplugin): p.implements(p.iresourcepreview, inherit=true) def can_preview(self, data_dict): format = data_dict['resource']['format'] return format.lower() == 'gtfs' def preview_template(self, context, data_dict): return 'preview.html'
Comments
Post a Comment