From c0db94798742f9590e184f4f823ff6a3fff64f8b Mon Sep 17 00:00:00 2001 From: mjanez <96422458+mjanez@users.noreply.github.com> Date: Wed, 19 Apr 2023 11:49:11 +0200 Subject: [PATCH] Add resourcedictionary ckan patch Avoids UI errors when using data dictionaries for datasets that are not stored in the datastore. --- .../02_resourcedictionary_templates.patch | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 ckan/patches/ckan/02_resourcedictionary_templates.patch diff --git a/ckan/patches/ckan/02_resourcedictionary_templates.patch b/ckan/patches/ckan/02_resourcedictionary_templates.patch new file mode 100644 index 0000000..f881ff8 --- /dev/null +++ b/ckan/patches/ckan/02_resourcedictionary_templates.patch @@ -0,0 +1,60 @@ +diff --git a/ckan/templates/package/resource_read.html b/ckan/templates/package/resource_read.html +index 7c8c6f9..6f2342a 100644 +--- a/ckan/templates/package/resource_read.html ++++ b/ckan/templates/package/resource_read.html +@@ -40,12 +40,14 @@ + {{ _('API Endpoint') }} + {% elif not res.has_views and not res.url_type == 'upload' %} + {{ _('Go to resource') }} ++ {% elif res.has_views and not res.url_type == 'upload' %} ++ {{ _('Go to resource') }} + {% else %} + {{ _('Download') }} + {% endif %} + + {% block download_resource_button %} +- {% if res.datastore_active %} ++ {% if res.datastore_active and res.url_type == 'datastore' %} + +@@ -224,4 +226,4 @@ + {% block resource_license %} + {% snippet "snippets/social.html" %} + {% endblock %} +-{% endblock %} ++{% endblock %} +\ No newline at end of file +diff --git a/ckanext/datastore/templates-bs2/package/resource_read.html b/ckanext/datastore/templates-bs2/package/resource_read.html +index 3c77876..1d856e0 100644 +--- a/ckanext/datastore/templates-bs2/package/resource_read.html ++++ b/ckanext/datastore/templates-bs2/package/resource_read.html +@@ -2,7 +2,7 @@ + + {% block resource_actions_inner %} + {{ super() }} +- {% if res.datastore_active %} ++ {% if res.datastore_active and res.url_type == 'datastore' %} +
  • {% snippet 'package/snippets/data_api_button.html', resource=res %}
  • + {% endif %} + {% endblock %} +@@ -34,4 +34,4 @@ + + {% endif %} + {{ super() }} +-{% endblock %} ++{% endblock %} +\ No newline at end of file +diff --git a/ckanext/datastore/templates/package/resource_read.html b/ckanext/datastore/templates/package/resource_read.html +index 2e1fdef..9caad53 100644 +--- a/ckanext/datastore/templates/package/resource_read.html ++++ b/ckanext/datastore/templates/package/resource_read.html +@@ -2,7 +2,7 @@ + + {% block resource_actions_inner %} + {{ super() }} +- {% if res.datastore_active %} ++ {% if res.datastore_active and res.url_type == 'datastore' %} +
  • {% snippet 'package/snippets/data_api_button.html', resource=res %}
  • + {% endif %} + {% endblock %}