From 10b60d555df30a4be8240450d031fbc6079084ca Mon Sep 17 00:00:00 2001 From: Ian Ward Date: Fri, 27 Jan 2017 13:12:56 -0500 Subject: [PATCH] [#3414] remove if datapusher in g.plugins from core templates --- ckan/templates/package/resource_edit_base.html | 4 +--- ckanext/datapusher/plugin.py | 4 ++++ ckanext/datapusher/templates/package/resource_edit_base.html | 5 +++++ 3 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 ckanext/datapusher/templates/package/resource_edit_base.html diff --git a/ckan/templates/package/resource_edit_base.html b/ckan/templates/package/resource_edit_base.html index ce991239664..70313c94d7a 100644 --- a/ckan/templates/package/resource_edit_base.html +++ b/ckan/templates/package/resource_edit_base.html @@ -22,9 +22,7 @@ {% block content_primary_nav %} {{ h.build_nav_icon('resource_edit', _('Edit resource'), id=pkg.name, resource_id=res.id) }} - {% if 'datapusher' in g.plugins %} - {{ h.build_nav_icon('resource_data', _('DataStore'), id=pkg.name, resource_id=res.id) }} - {% endif %} + {% block inner_primary_nav %}{% endblock %} {{ h.build_nav_icon('views', _('Views'), id=pkg.name, resource_id=res.id) }} {% endblock %} diff --git a/ckanext/datapusher/plugin.py b/ckanext/datapusher/plugin.py index a7db0f66aa7..553609f1f3f 100644 --- a/ckanext/datapusher/plugin.py +++ b/ckanext/datapusher/plugin.py @@ -72,6 +72,7 @@ def resource_data(self, id, resource_id): class DatapusherPlugin(p.SingletonPlugin): + p.implements(p.IConfigurer, inherit=True) p.implements(p.IConfigurable, inherit=True) p.implements(p.IActions) p.implements(p.IAuthFunctions) @@ -83,6 +84,9 @@ class DatapusherPlugin(p.SingletonPlugin): legacy_mode = False resource_show_action = None + def update_config(self, config): + p.toolkit.add_template_directory(config, 'templates') + def configure(self, config): self.config = config diff --git a/ckanext/datapusher/templates/package/resource_edit_base.html b/ckanext/datapusher/templates/package/resource_edit_base.html new file mode 100644 index 00000000000..7c45a5bab08 --- /dev/null +++ b/ckanext/datapusher/templates/package/resource_edit_base.html @@ -0,0 +1,5 @@ +{% ckan_extends %} + +{% block inner_primary_nav %} + {{ h.build_nav_icon('resource_data', _('DataPusher'), id=pkg.name, resource_id=res.id) }} +{% endblock %}