Skip to content

Commit

Permalink
[2564] Update additional info fields on resource view
Browse files Browse the repository at this point in the history
These now show extra fields, also info in the sidebar is also hooked
up properly.
  • Loading branch information
aron committed Jun 19, 2012
1 parent bb41d86 commit df8f82c
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 49 deletions.
16 changes: 8 additions & 8 deletions ckan/templates/package/read.html
Expand Up @@ -61,24 +61,24 @@ <h3>Data and Resources</h3>
{% endif %}
</section>

{{ h.snippet('package/snippets/tags.html', tags=pkg.tags) }}
{% snippet "package/snippets/tags.html", tags=pkg.tags %}

{{ h.snippet('package/snippets/additional_info.html', pkg_dict=pkg) }}
{% snippet "package/snippets/additional_info.html", pkg_dict=pkg %}
</article>
{% endblock %}

{% block secondary_content %}
{% for group in pkg.groups %}
{{ h.snippet('snippets/group.html', group=group) }}
{% snippet "snippets/group.html", group=group %}
{% endfor %}

{{ h.snippet('snippets/subscribe.html') }}
{% snippet "snippets/subscribe.html" %}

{{ h.snippet('snippets/social.html') }}
{% snippet "snippets/social.html" %}

{{ h.snippet('snippets/related.html', pkg=pkg) }}
{% snippet "snippets/related.html", pkg=pkg %}

{{ h.snippet('snippets/license.html', pkg_dict=pkg) }}
{% snippet "snippets/license.html", pkg_dict=pkg %}

{{ h.snippet('snippets/disqus_trackback.html') }}
{% snippet "snippets/disqus_trackback.html" %}
{% endblock %}
83 changes: 42 additions & 41 deletions ckan/templates/package/resource_read.html
@@ -1,23 +1,24 @@
{% extends "page.html" %}

{% set pkg = c.pkg_dict %}
{% set res = c.resource %}

{% block title %}{{ h.dataset_display_name(c.package) }} - {{ h.resource_display_name(c.resource) }} - {{ super() }}{% endblock %}
{% block title %}{{ h.dataset_display_name(c.package) }} - {{ h.resource_display_name(res) }} - {{ super() }}{% endblock %}

{% block breadcrumb_content %}
<li>{% link_for _('Datasets'), controller='package', action='search', highlight_actions = 'new index' %}</li>
<li>{% link_for h.dataset_display_name(c.package)|truncate(30), controller='package', action='read', id=c.package.get('name') %}</li>
<li class="active"><a href="">{{ h.resource_display_name(c.resource)|truncate(30) }}</a></li>
<li class="active"><a href="">{{ h.resource_display_name(res)|truncate(30) }}</a></li>
{% endblock %}

{% block actions_content %}
{% if c.resource.url %}
{% if res.url %}
{% snippet 'package/snippets/back_to_package_action.html', pkg=pkg %}
<li>
<a class="btn resource-url-analytics resource-type-{{ c.resource.resource_type }}" href="{{ c.resource.url }}">
{% if c.resource.resource_type in ('listing', 'service') %}
<a class="btn resource-url-analytics resource-type-{{ res.resource_type }}" href="{{ res.url }}">
{% if res.resource_type in ('listing', 'service') %}
{{ _('View') }}
{% elif c.resource.resource_type == 'api' %}
{% elif res.resource_type == 'api' %}
{{ _('API Endpoint') }}
{% else %}
<i class="icon-large icon-download"></i> Download
Expand All @@ -27,7 +28,7 @@
{% endif %}
{% if config.get('ckan.datastore.enabled', false) %}
<li>
{% if c.resource.webstore_url %}
{% 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>
Expand All @@ -38,53 +39,53 @@

{% block primary_content %}
<section class="module">
<div class="content">
<h1>{{ h.resource_display_name(c.resource) }}</h1>
<div class="content prose">
<h1>{{ h.resource_display_name(res) }}</h1>

<div class="notes" property="rdfs:label">
{{ c.resource.get('description') or '(No description)' }}
{% if not c.resource.description and c.package.notes %}
{{ res.description or _('(No description)') }}
{% if not res.description and c.package.notes %}
<div>{{ h.markdown_extract(c.package.get('notes')) }}</div>
<small>From the <a href="{{ h.url_for(controller='package', action='read', id=c.package['name']) }}">Dataset</a></small>
{% endif %}
</div>
</div>
<div class="resource-preview content">
<div class="preview-header">
{# TODO: Hiding data preview until we have javascript in place #}
<div class="preview-header" style="display: none;">
<h3>Preview</h3>
{% if c.pkg.is_private %}
<a title="Cannot embed as resource is private." style="display: none;" class="btn disabled" data-toggle="modal" href=".modal-data-viewer-embed-dialog">Embed</a>
<span title="Cannot embed as resource is private." class="btn disabled">Embed</span>
{% else %}
<a style="display: none;" class="btn btn-primary" data-toggle="modal" href=".modal-data-viewer-embed-dialog">Embed</a>
<a class="btn btn-primary" data-toggle="modal" href=".modal-data-viewer-embed-dialog">Embed</a>
{% endif %}
</div>
<div id="ckanext-datapreview content"></div>
</div>
</section>

<section class="module">
<div class="content">
<h2>Additional Information</h2>
<table class="table table-striped table-bordered table-condensed">
<thead>
<tr>
<th>Field</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<tr>
<th>Last Updated</th>
<td>{{ h.time_ago_in_words_from_str(c.resource['last_modified'], granularity='day') }}</td>
</tr>
<tr>
<th>Licence</th>
<td>{{ h.snippet('snippets/license.html', pkg_dict=pkg, text_only=True) }}</td>
</tr>
</tbody>
</table>
</div>
</section>
{% if res %}
<section class="module">
<div class="content">
<h2>Additional Information</h2>
<table class="table table-striped table-bordered table-condensed">
<thead>
<tr>
<th>Field</th>
<th>Value</th>
</tr>
</thead>
<tbody>
{% with blacklist = ["name", "description", "url"] %}
{% for key,value in res.items()|sort if key not in blacklist %}
<tr><th>{{ key }}</th><td>{{ value }}</td></tr>
{% endfor %}
{% endwith %}
</tbody>
</table>
</div>
</section>
{% endif %}

{% if config.get('ckan.datastore.enabled', false) %}
<section class="module">
Expand All @@ -97,11 +98,11 @@ <h2>Additional Information</h2>
<section class="module">
<h2 class="heading"><i class="icon-large icon-info-sign"></i> Resource Information</h2>
<ul class="simple-list">
<li><i class="ckan-icon ckan-icon-calendar"></i> Unknown</li>
<li><i class="ckan-icon ckan-icon-file"></i> CSV</li>
<li><i class="ckan-icon ckan-icon-lock"></i> {{ h.snippet('snippets/license.html', pkg_dict=pkg, text_only=True) }}</li>
<li><i class="ckan-icon ckan-icon-calendar"></i> Last Updated: {{ h.render_datetime(res.last_modified) or _("unknown") }}</li>
<li><i class="ckan-icon ckan-icon-file"></i> Format: {{ res.mimetype_inner or res.mimetype or _("unknown") }}</li>
<li><i class="ckan-icon ckan-icon-lock"></i> {% snippet "snippets/license.html", pkg_dict=pkg, text_only=True %}</li>
</ul>
</section>

{{ h.snippet('snippets/social.html') }}
{% snippet "snippets/social.html" %}
{% endblock %}

0 comments on commit df8f82c

Please sign in to comment.