Skip to content
Snippets Groups Projects
Commit d58d5cab authored by Benjamin Becker's avatar Benjamin Becker
Browse files

WIP: adds template for collection list

parent 3605a4b4
Branches
Tags
No related merge requests found
from ckan.lib.plugins import DefaultTranslation, DefaultDatasetForm
import ckan.plugins as plugins
import ckan.plugins.toolkit as toolkit
import helpers as collection_helpers
from routes.mapper import SubMapper
......@@ -8,6 +9,7 @@ class CollectionsPlugin(plugins.SingletonPlugin, DefaultDatasetForm):
plugins.implements(plugins.IDatasetForm, inherit=True)
plugins.implements(plugins.IRoutes, inherit=True)
plugins.implements(plugins.ITemplateHelpers)
plugins.implements(plugins.IConfigurer)
# IDataSetForm
......@@ -17,6 +19,9 @@ class CollectionsPlugin(plugins.SingletonPlugin, DefaultDatasetForm):
def is_fallback(self):
return False
def read_template(self):
return 'package/collection_read.html'
# IRoutes
def before_map(self, map):
......@@ -55,3 +60,12 @@ class CollectionsPlugin(plugins.SingletonPlugin, DefaultDatasetForm):
return {
'get_collection': collection_helpers.get_collection,
}
# IConfigurer
def update_config(self, config):
# Add this plugin's templates dir to CKAN's extra_template_paths, so
# that CKAN will use this plugin's custom templates.
# 'templates' is the path to the templates dir, relative to this
# plugin.py file.
toolkit.add_template_directory(config, 'templates_collections')
Test
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment