{# Renders a single resource with icons and view links. res - A resource dict to render pkg - A package dict that the resource belongs to can_edit - Whether the user is allowed to edit the resource url_is_edit - Whether the link to the resource should be to editing it (set to False to make the link view the resource) is_activity_archive - Whether this is an old version of the dataset (and therefore read-only) Example: {% snippet "package/snippets/resource_item.html", res=resource, pkg_dict=pkg_dict, can_edit=True, url_is_edit=False %} #} {% set url_action = pkg.type ~ ('_resource.edit' if url_is_edit and can_edit else '_resource.read') %} {% set url = h.url_for(url_action, id=pkg.id if is_activity_archive else pkg.name, resource_id=res.id, **({'activity_id': request.args['activity_id']} if 'activity_id' in request.args else {})) %}
  • {% block resource_item_title %} {{ h.resource_display_name(res) | truncate(50) }}{{ h.get_translated(res, 'format') }} {{ h.popular('views', res.tracking_summary.total, min=10) if res.tracking_summary }} {% endblock %} {% block resource_item_description %}

    {% if res.description %} {{ h.markdown_extract(h.get_translated(res, 'description'), extract_length=80) }} {% endif %}

    {% endblock %} {% block resource_item_explore %} {% if not url_is_edit %} {% endif %} {% endblock %}