Update web/templates/stats.html
This commit is contained in:
parent
d4ef68ee72
commit
529d284050
@ -36,22 +36,31 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Top subjects -->
|
||||
<!-- Tag Cloud (replaces Top Subjects) -->
|
||||
<div class="card" style="padding:16px; margin-bottom:16px;">
|
||||
<div class="meta-label">Top Subjects</div>
|
||||
<div style="display:flex; flex-wrap:wrap; gap:8px; margin-top:8px;">
|
||||
{% for s in top_subjects %}
|
||||
<a
|
||||
class="chip chip-link"
|
||||
href="{% url 'search' %}?q={{ s.name|urlencode }}&subject=on"
|
||||
title="Search subject: {{ s.name }}"
|
||||
>
|
||||
{{ s.name }} ({{ s.count }})
|
||||
</a>
|
||||
{% empty %}
|
||||
<span class="muted">No subjects.</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="meta-label">Subject Cloud</div>
|
||||
|
||||
{% if top_subjects %}
|
||||
{# max count is the first item because list is sorted desc in the view #}
|
||||
{% with maxc=top_subjects.0.count|default:1 %}
|
||||
<div class="tag-cloud" aria-label="Subject Tag Cloud">
|
||||
{% for s in top_subjects %}
|
||||
{# font-size from 14px up to 32px based on weight #}
|
||||
<a
|
||||
class="tag"
|
||||
href="{% url 'search' %}?q={{ s.name|urlencode }}&subject=on"
|
||||
title="{{ s.name }} ({{ s.count }})"
|
||||
style="font-size: calc(14px + ({{ s.count }} / {{ maxc }}) * 18px);
|
||||
opacity: calc(.6 + ({{ s.count }} / {{ maxc }}) * .4);"
|
||||
>
|
||||
{{ s.name }}
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endwith %}
|
||||
{% else %}
|
||||
<span class="muted">No subjects.</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<!-- Scripture usage -->
|
||||
@ -91,4 +100,30 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.tag-cloud{
|
||||
display:flex;
|
||||
flex-wrap:wrap;
|
||||
gap:10px 14px;
|
||||
margin-top:10px;
|
||||
align-items:flex-end;
|
||||
}
|
||||
.tag{
|
||||
line-height:1.1;
|
||||
padding:6px 10px;
|
||||
border-radius:12px;
|
||||
text-decoration:none;
|
||||
color:#0f172a;
|
||||
background:#eef5fc;
|
||||
border:1px solid #d7e6f7;
|
||||
transition: transform .1s ease, background .12s ease, border-color .12s ease;
|
||||
white-space:nowrap;
|
||||
}
|
||||
.tag:hover{
|
||||
transform: translateY(-1px);
|
||||
background:#e2effc;
|
||||
border-color:#c9def5;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
Loading…
Reference in New Issue
Block a user