--- a/ckanext/ga_report/plugin.py +++ b/ckanext/ga_report/plugin.py @@ -2,19 +2,27 @@ import ckan.lib.helpers as h import ckan.plugins as p from ckan.plugins import implements, toolkit -#import gasnippet -#import commands -#import dbutil log = logging.getLogger('ckanext.ga-report') class GAReportPlugin(p.SingletonPlugin): implements(p.IConfigurer, inherit=True) implements(p.IRoutes, inherit=True) + implements(p.ITemplateHelpers, inherit=True) def update_config(self, config): toolkit.add_template_directory(config, 'templates') toolkit.add_public_directory(config, 'public') + + def get_helpers(self): + """ + A dictionary of extra helpers that will be available to provide + ga report info to templates. + """ + from ckanext.ga_report.helpers import most_popular_datasets + return { + 'most_popular_datasets': most_popular_datasets + } def after_map(self, map): map.connect(