73 lines
2.7 KiB
HTML
73 lines
2.7 KiB
HTML
{#
|
|
Displays a single of dataset.
|
|
|
|
package - A package to display.
|
|
item_class - The class name to use on the list item.
|
|
hide_resources - If true hides the resources (default: false).
|
|
banner - If true displays a popular banner (default: false).
|
|
truncate - The length to trucate the description to (default: 180)
|
|
truncate_title - The length to truncate the title to (default: 80).
|
|
|
|
Example:
|
|
|
|
{% snippet 'snippets/package_item.html', package=c.datasets[0] %}
|
|
|
|
#}
|
|
{% set truncate = truncate or 180 %}
|
|
{% set truncate_title = truncate_title or 80 %}
|
|
{% set title = package.title or package.name %}
|
|
{% set notes = h.markdown_extract(package.notes, extract_length=truncate) %}
|
|
{% set acquired = h.is_dataset_acquired(package) %}
|
|
{% set owner = h.is_owner(package) %}
|
|
|
|
{% resource 'privatedatasets/custom.css' %}
|
|
|
|
<li class="{{ item_class or "dataset-item" }}">
|
|
{% block package_item_content %}
|
|
<div class="dataset-content">
|
|
<h3 class="dataset-heading">
|
|
{% if package.private and not h.can_read(package) %}
|
|
<span class="dataset-private label label-inverse">
|
|
<i class="icon-lock"></i>
|
|
{{ _('Private') }}
|
|
</span>
|
|
{% endif %}
|
|
{% if acquired and not owner %}
|
|
<span class="dataset-private label label-acquired">
|
|
<i class="icon-shopping-cart"></i>
|
|
{{ _('Acquired') }}
|
|
</span>
|
|
{% endif %}
|
|
{% if owner %}
|
|
<span class="dataset-private label label-owner">
|
|
<i class="icon-user"></i>
|
|
{{ _('Owner') }}
|
|
</span>
|
|
{% endif %}
|
|
{{ h.link_to(h.truncate(title, truncate_title), h.url_for(controller='package', action='read', id=package.name)) }}
|
|
{% if package.get('state', '').startswith('draft') %}
|
|
<span class="label label-info">{{ _('Draft') }}</span>
|
|
{% elif package.get('state', '').startswith('deleted') %}
|
|
<span class="label label-important">{{ _('Deleted') }}</span>
|
|
{% endif %}
|
|
{{ h.popular('recent views', package.tracking_summary.recent, min=10) if package.tracking_summary }}
|
|
</h3>
|
|
{% if banner %}
|
|
<span class="banner">{{ _('Popular') }}</span>
|
|
{% endif %}
|
|
{% if notes %}
|
|
<div>{{ notes|urlize }}</div>
|
|
{% endif %}
|
|
</div>
|
|
{% if package.resources and not hide_resources %}
|
|
<ul class="dataset-resources unstyled">
|
|
{% for resource in h.dict_list_reduce(package.resources, 'format') %}
|
|
<li>
|
|
<a href="{{ h.url_for(controller='package', action='read', id=package.name) }}" class="label" data-format="{{ resource.lower() }}">{{ resource }}</a>
|
|
</li>
|
|
{% endfor %}
|
|
</ul>
|
|
{% endif %}
|
|
{% endblock %}
|
|
</li>
|