Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditional DataStore Tab in Resource Edit #190

Merged
6 changes: 6 additions & 0 deletions ckanext/xloader/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@ def xloader_status_description(status):
return captions.get(status['status'], status['status'].capitalize())
else:
return _('Not Uploaded Yet')


def is_xloader_format(resource_format):
from ckanext.xloader.plugin import XLoaderFormats

return XLoaderFormats.is_it_an_xloader_format(resource_format)
1 change: 1 addition & 0 deletions ckanext/xloader/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,4 +211,5 @@ def get_helpers(self):
return {
"xloader_status": xloader_helpers.xloader_status,
"xloader_status_description": xloader_helpers.xloader_status_description,
"is_xloader_format": xloader_helpers.is_xloader_format,
}
4 changes: 3 additions & 1 deletion ckanext/xloader/templates/package/resource_edit_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@

{% block inner_primary_nav %}
{{ super() }}
{{ h.build_nav_icon('xloader.resource_data', _('DataStore'), id=pkg.name, resource_id=res.id) }}
{% if h.is_xloader_format(res.format) or res.datastore_active %}
{{ h.build_nav_icon('xloader.resource_data', _('DataStore'), id=pkg.name, resource_id=res.id) }}
{% endif %}
{% endblock %}