Skip to content

Commit

Permalink
[#2375] datastore data api button cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
tobes committed Jul 13, 2012
1 parent 25305c5 commit 4e1524e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
10 changes: 2 additions & 8 deletions ckan/templates/package/resource_read.html
Expand Up @@ -26,14 +26,8 @@
</a>
</li>
{% endif %}
{% if config.get('ckan.datastore.enabled', false) %}
<li>
{% if res.webstore_url %}
<a class="btn" data-toggle="modal" href="#modal-data-api-help"><i class="icon-large icon-beaker"></i> {{ _('Data API') }}</a>
{% else %}
<a class="btn disabled" rel="tooltip" title="{{ _('Data API is unavailable for this resource as DataStore is disabled') }}"><i class="icon-large icon-beaker"></i> {{ _('Data API') }}</a>
{% endif %}
</li>
{% if config.get('ckan.datastore.enabled', False) %}
{% snippet 'package/snippets/data-api-button.html', resource=res, datastore_root_url=c.datastore_api %}
{% endif %}
<a class="btn" href="{% url_for controller='package', action='resource_edit', id=c.package.id, resource_id=res.id %}"><i class="icon-large icon-wrench"></i> {{ _('Edit') }}</a>
{% endblock %}
Expand Down
11 changes: 11 additions & 0 deletions ckan/templates/package/snippets/data-api-button.html
@@ -0,0 +1,11 @@
{# Data API Help Button

resource: the resource
datastore_root_url: the root url of the datastore

#}
{% if resource.webstore_url %}
<a class="btn btn-success" data-toggle="modal" href="{% url_for controller='api', action='snippet', ver=1, snippet_path='api-info.html', datastore_root_url=datastore_root_url %}">Data API</a>
{% else %}
<a class="btn disabled" rel="tooltip" title="Data API is unavailable for this resource as DataStore is disabled">Data API</a>
{% endif %}

0 comments on commit 4e1524e

Please sign in to comment.