{# |
{# |
Displays a single related item. |
Displays a single related item. |
|
|
related - The related item dict. |
related - The related item dict. |
pkg_id - The id of the owner package. If present the edit button will be |
pkg_id - The id of the owner package. If present the edit button will be |
displayed. |
displayed. |
|
|
Example: |
Example: |
|
|
|
|
|
|
#} |
#} |
{% set placeholder_map = { |
{% set placeholder_map = { |
'application': h.url_for_static('/base/images/placeholder-application.png') |
'application': h.url_for_static('/base/images/placeholder-application.png') |
} %} |
} %} |
{% set tooltip = _('Go to {related_item_type}').format(related_item_type=related.type|replace('_', ' ')|title) %} |
{% set tooltip = _('Go to {related_item_type}').format(related_item_type=related.type|replace('_', ' ')|title) %} |
<li class="related-item media-item" data-module="related-item"> |
<li class="related-item media-item" data-module="related-item"> |
<img src="{{ related.image_url or placeholder_map[related.type] or h.url_for_static('/base/images/placeholder-image.png') }}" alt="{{ related.title }}" class="media-image"> |
<img src="{{ related.image_url or placeholder_map[related.type] or h.url_for_static('/base/images/placeholder-image.png') }}" alt="{{ related.title }}" class="media-image"> |
<h3 class="media-heading">{{ related.title }}</h3> |
<h3 class="media-heading">{{ related.title }}</h3> |
{% if related.description %} |
{% if related.description %} |
<div class="prose"> |
<div class="prose"> |
{{ h.render_markdown(related.description) }} |
{{ h.render_markdown(related.description) }} |
</div> |
</div> |
{% endif %} |
{% endif %} |
{% if h.get_related_dataset(related.id) %} |
{% if h.check_access('package_show',{"id":h.get_related_dataset(related.id)}) %} |
<small>Using dataset: {{ h.get_related_dataset(related.id).title }}</small> |
<small>Using dataset: {{ h.get_action('package_show',{"id":h.get_related_dataset(related.id)}).title }}</small> |
{% endif %} |
{% endif %} |
|
|
<a class="media-view" href="{{ related.url }}" target="_blank" title="{{ tooltip }}"> |
<a class="media-view" href="{{ related.url }}" target="_blank" title="{{ tooltip }}"> |
<span>{{ tooltip }}</span> |
<span>{{ tooltip }}</span> |
<span class="banner"> |
<span class="banner"> |
{%- if related.type == 'application' -%} |
{%- if related.type == 'application' -%} |
app |
app |
{%- elif related.type == 'visualization' -%} |
{%- elif related.type == 'visualization' -%} |
viz |
viz |
{%- else -%} |
{%- else -%} |
{{ related.type | replace('news_', '') }} |
{{ related.type | replace('news_', '') }} |
{%- endif -%} |
{%- endif -%} |
</span> |
</span> |
</a> |
</a> |
{% if pkg_id %} |
{% if pkg_id %} |
{{ h.nav_link(_('Edit'), controller='related', action='edit', id=pkg_id, related_id=related.id, class_='btn btn-primary btn-small media-edit') }} |
{{ h.nav_link(_('Edit'), controller='related', action='edit', id=pkg_id, related_id=related.id, class_='btn btn-primary btn-small media-edit') }} |
{% endif %} |
{% endif %} |
</li> |
</li> |
{% if position is divisibleby 3 %} |
{% if position is divisibleby 3 %} |
<li class="clearfix js-hide"></li> |
<li class="clearfix js-hide"></li> |
{% endif %} |
{% endif %} |
|
|