-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpackage_item.html
More file actions
102 lines (97 loc) · 4.12 KB
/
Copy pathpackage_item.html
File metadata and controls
102 lines (97 loc) · 4.12 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
{#
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) %}
{% block package_item %}
<li class="mt-2 border-t-1 border-gray-400 px-5 py-6">
{% block content %}
{% set pkg_org = package.get('organization') %}
{% set image_url = pkg_org.get('image_url') if pkg_org else '' %}
{% set title = pkg_org.get('title') if pkg_org else '' %}
<div>
<div class="flex flex-row">
<div id="org_logo" class="flex items-center h-40 w-1/5 pr-4">
<img class="inline-block w-full" src="/uploads/group/{{ image_url }}" alt="{{ title }}">
</div>
<div class="flex flex-col w-4/5">
{% block heading %}
<h3 class="text-lg font-bold">
{% block heading_private %}
{% if package.private %}
<span class="dataset-private label label-inverse">
<i class="fa fa-lock"></i>
{{ _('Private') }}
</span>
{% endif %}
{% endblock %}
{% block heading_title %}
<a href="{{ h.url_for('%s.read' % package.type, id=package.name) }}" class="text-gray-900 hover:text-primary">
{{ title | truncate(truncate_title, killwords=True, end='...') }}
</a>
{% endblock %}
{% block heading_meta %}
{% if package.get('state', '').startswith('draft') %}
<span class="label label-info">{{ _('Draft') }}</span>
{% elif package.get('state', '').startswith('deleted') %}
<span class="label label-danger">{{ _('Deleted') }}</span>
{% endif %}
{{ h.popular('recent views', package.tracking_summary.recent, min=10) if package.tracking_summary }}
{% endblock %}
</h3>
{% endblock %}
{% block banner %}
{% if banner %}
<span class="banner">{{ _('Popular') }}</span>
{% endif %}
{% endblock %}
{% block notes %}
{% if notes %}
<div class="flex flex-col leading-loose text-lg text-gray-ink my-3">
<div class="w-full">
<div class="markdown-content leading-relaxed">
<p class="block"></p>
<p>{{ notes }}</p>
<p></p>
</div>
</div>
</div>
{% else %}
<p class="empty">{{ _("This dataset has no description") }}</p>
{% endif %}
{% block resources %}
{% if package.resources and not hide_resources %}
{% block resources_outer %}
<ul class="mt-2">
{% block resources_inner %}
{% for resource in h.dict_list_reduce(package.resources, 'format') %}
<span hidden>1</span>
<span hidden>2</span>
<li class="inline">
<span class="font-bold text-sm text-primary border-1 border-gray-400 rounded py-1 px-2 mr-1">
{{ resource }}
</span>
</li>
{% endfor %}
{% endblock %}
</ul>
{% endblock %}
{% endif %}
{% endblock %}
{% endblock %}
</div>
</div>
</div>
{% endblock%}
</li>
{% endblock %}