Update web/templates/stats.html
This commit is contained in:
+67
-20
@@ -1,32 +1,79 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% block title %}Statistics - Illustrations DB{% endblock %}
|
{% block body_class %}themed-bg{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="panel">
|
<div class="container">
|
||||||
<h1>Statistics</h1>
|
<h1 class="page-title">Statistics</h1>
|
||||||
<div class="row">
|
|
||||||
<div class="stat"><div class="small">Total entries</div><div style="font-size:28px; font-weight:700;">{{ total }}</div></div>
|
<div class="card" style="padding:16px; margin-bottom:16px;">
|
||||||
<div class="stat"><div class="small">New in last 30 days</div><div style="font-size:28px; font-weight:700;">{{ last30 }}</div></div>
|
<div class="meta-grid">
|
||||||
<div class="stat"><div class="small">New in last 365 days</div><div style="font-size:28px; font-weight:700;">{{ last365 }}</div></div>
|
<div>
|
||||||
|
<div class="meta-label">Total Illustrations</div>
|
||||||
|
<div class="subject-title" style="margin:0">{{ total }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="spacer"></div>
|
<div>
|
||||||
<h2>Trend (last 12 months)</h2>
|
<div class="meta-label">Added in last 30 days</div>
|
||||||
<div class="card">
|
<div class="subject-title" style="margin:0">{{ last30 }}</div>
|
||||||
<div class="small">Entries per month (by Date Added)</div>
|
</div>
|
||||||
<div style="display:flex; gap:6px; align-items:flex-end; height:120px; margin-top:8px;">
|
<div>
|
||||||
|
<div class="meta-label">Added in last 365 days</div>
|
||||||
|
<div class="subject-title" style="margin:0">{{ last365 }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Sparkline (simple bars) -->
|
||||||
|
<div class="card" style="padding:16px; margin-bottom:16px;">
|
||||||
|
<div class="meta-label">Adds by Month (last 12)</div>
|
||||||
|
<div style="display:flex; align-items:flex-end; gap:6px; height:140px; margin-top:8px;">
|
||||||
{% for label, value, height in heights %}
|
{% for label, value, height in heights %}
|
||||||
<div title="{{ label }}: {{ value }}" style="width:24px; background:#dbe7ff; border:1px solid #c8d6ff; height: {{ height }}px;"></div>
|
<div title="{{ label }} = {{ value }}"
|
||||||
|
style="width:22px; height:{{ height }}px; background:#cfe3f6; border:1px solid #bcd4ee; border-radius:6px;"></div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
<div class="small" style="display:flex; gap:8px; flex-wrap:wrap; margin-top:6px;">
|
<div class="small muted" style="margin-top:6px;">
|
||||||
{% for label, value in series %}<span>{{ label }}</span>{% endfor %}
|
{% for label, value in series %}{% if not forloop.last %}{{ label }} · {% else %}{{ label }}{% endif %}{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="spacer"></div>
|
|
||||||
<h2>Top Subjects</h2>
|
<!-- Top subjects -->
|
||||||
<div class="cards">
|
<div class="card" style="padding:16px; margin-bottom:16px;">
|
||||||
{% for item in top_subjects %}
|
<div class="meta-label">Top Subjects</div>
|
||||||
<div class="card"><div style="font-weight:600;">{{ item.name }}</div><div class="small">{{ item.count }} entries</div></div>
|
<div style="display:flex; flex-wrap:wrap; gap:8px; margin-top:8px;">
|
||||||
|
{% for s in top_subjects %}
|
||||||
|
<span class="chip chip-muted">{{ s.name }} ({{ s.count }})</span>
|
||||||
|
{% empty %}
|
||||||
|
<span class="muted">No subjects.</span>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Tools: Scripture normalizer -->
|
||||||
|
<div class="card" style="padding:16px; margin-bottom:24px;">
|
||||||
|
<div class="meta-label">Tools</div>
|
||||||
|
<div class="small muted" style="margin:6px 0 10px;">
|
||||||
|
Normalize scripture references (abbreviations, separators, repeat book names where needed).
|
||||||
|
</div>
|
||||||
|
<div style="display:flex; gap:10px; flex-wrap:wrap;">
|
||||||
|
<!-- Dry‑run -->
|
||||||
|
<form method="get" action="{% url 'normalize_scripture' %}">
|
||||||
|
<input type="hidden" name="limit" value="">
|
||||||
|
<button class="btn btn-secondary">Preview (dry‑run)</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
{% if user.is_authenticated and user.is_staff %}
|
||||||
|
<!-- Apply -->
|
||||||
|
<form method="post" action="{% url 'normalize_scripture' %}">
|
||||||
|
{% csrf_token %}
|
||||||
|
<button class="btn btn-danger" onclick="return confirm('Apply normalization to ALL entries? This will modify scripture_raw fields.');">
|
||||||
|
Apply to all
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
<div class="small muted" style="margin-top:8px;">
|
||||||
|
Tip: you can pass <code>?limit=1000</code> on the preview URL to test a subset.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user