forked from ckan/ckan
/
info.html
112 lines (110 loc) · 4.21 KB
/
info.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
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
103
104
105
106
107
108
109
110
111
112
{% set user = user_dict if not user else user %}
{% set orgs_available = h.organizations_available(permission='manage_group',
include_dataset_count=True,
include_member_count=True,
user=user['name'])
%}
{% set groups_available = h.groups_available(am_member=True,
include_dataset_count=True,
include_member_count=True,
user=user['name'])
%}
<div id="user-info" class="module context-info">
<section class="module-content">
{% block secondary_content_inner %}
{% block user_image %}
<div class="image">{{ h.user_image(user.id, size=270) }}</div>
{% endblock %}
{% block user_heading %}
<h1 class="heading">{{ user.display_name }}</h1>
{% endblock %}
{% block user_about %}
{% if about_formatted %}
{{ about_formatted }}
{% else %}
<p class="empty">
{% if is_myself %}
{% trans %}You have not provided a biography.{% endtrans %}
{% else %}
{% trans %}This user has no biography.{% endtrans %}
{% endif %}
</p>
{% endif %}
{% endblock %}
{% block user_nums %}
{% set num_followers = h.follow_count('user', user.id) %}
<div class="nums">
<dl>
<dt>{{ _('Followers') }}</dt>
<dd>{{ h.SI_number_span(num_followers) }}</dd>
</dl>
<dl>
<dt>{{ h.humanize_entity_type('package', dataset_type, 'facet label') or _('Datasets') }}</dt>
<dd>{{ h.SI_number_span(user.number_created_packages) }}</dd>
</dl>
<dl>
<dt>{{ h.humanize_entity_type('organization', org_type, 'facet label') or _('Organizations') }}</dt>
<dd>{{ orgs_available | count }}</dd>
</dl>
<dl>
<dt>{{ h.humanize_entity_type('group', group_type, 'facet label') or _('Groups') }}</dt>
<dd>{{ groups_available | count }}</dd>
</dl>
</div>
{% endblock %}
{% if is_myself == false %}
{% block user_follow %}
{% if current_user.is_authenticated %}
{% if error_message %}
<div class="alert alert-danger">{{ error_message }}</div>
{% endif %}
{% if am_following %}
<a class="btn btn-danger" hx-post="{{ h.url_for('user.unfollow', id=user.id) }}" hx-target="#user-info"><i class="fa-solid fa-circle-minus"></i> Unfollow</a>
{% else %}
<a class="btn btn-success" hx-post="{{ h.url_for('user.follow', id=user.id) }}" hx-target="#user-info"><i class="fa-solid fa-circle-plus"></i> Follow</a>
{% endif %}
{% endif %}
{% endblock %}
{% endif %}
{% block user_info %}
<div class="info">
<dl>
{% if user.name.startswith('http://') or user.name.startswith('https://') %}
<dt>{{ _('Open ID') }}</dt>
<dd>{{ user.name|urlize(25) }}{# Be great if this just showed the domain #}</dd>
{% else %}
<dt>{{ _('Username') }}</dt>
<dd>{{ user.name }}</dd>
{% endif %}
</dl>
{% if is_myself %}
<dl>
<dt>{{ _('Email') }} <span class="label label-default" title="{{ _('This means only you can see this') }}">{{ _('Private') }}</span></dt>
<dd>{{ user.email }}</dd>
</dl>
{% endif %}
<dl>
<dt>{{ _('Member Since') }}</dt>
<dd>{{ h.render_datetime(user.created) }}</dd>
</dl>
{% if is_sysadmin %}
<dl>
<dt>{{_('Last Active') }}</dt>
<dd>{{ h.time_ago_from_timestamp(user.last_active) }}</dd>
</dl>
{% endif %}
<dl>
<dt>{{ _('State') }}</dt>
<dd>{{ _(user.state) }}</dd>
</dl>
{% if is_myself %}
<dl>
<dt class="key">{{ _('API Key') }} <span class="label label-default" title="{{ _('This means only you can see this') }}">{{ _('Private') }}</span></dt>
<dd class="value"><code>{{ user.apikey }}</code></dd>
</dl>
{% endif %}
</div>
{% endblock %}
{% endblock %}
</section>
</div>