Merge branch 'master' of git+ssh://maxious.lambdacomplex.org/git/ckanext-datagovau
[ckanext-datagovau.git] / ckanext / datagovau / templates / related / snippets / related_item.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{#
Displays a single related item.
 
related - The related item dict.
pkg_id  - The id of the owner package. If present the edit button will be
          displayed.
 
Example:
 
 
 
#}
{% set placeholder_map = {
'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) %}
<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">
  <h3 class="media-heading">{{ related.title }}</h3>
  {% if related.description %}
    <div class="prose">
{{ h.render_markdown(related.description) }}
</div>
  {% endif %}
  {% if h.check_access('package_show',{"id":h.get_related_dataset(related.id)}) %}
<small>Using dataset: {{ h.get_action('package_show',{"id":h.get_related_dataset(related.id)}).title  }}</small>
  {% endif %}
 
  <a class="media-view" href="{{ related.url }}" target="_blank" title="{{ tooltip }}">
    <span>{{ tooltip }}</span>
    <span class="banner">
      {%- if related.type == 'application' -%}
        app
      {%- elif related.type == 'visualization' -%}
        viz
      {%- else -%}
        {{ related.type | replace('news_', '') }}
      {%- endif -%}
    </span>
  </a>
  {% 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') }}
  {% endif %}
</li>
{% if position is divisibleby 3 %}
  <li class="clearfix js-hide"></li>
{% endif %}