Update web/templates/stats.html
This commit is contained in:
parent
f6193d4f9d
commit
d6819ca4b9
@ -36,8 +36,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Top subjects -->
|
<!-- Top subjects -->
|
||||||
<div class="card" style="padding:16px; margin-bottom:16px;">
|
<div class="card" style="padding:16px; margin-bottom:16px;">
|
||||||
<div class="meta-label">Top Subjects</div>
|
<div class="meta-label">Top Subjects</div>
|
||||||
<div style="display:flex; flex-wrap:wrap; gap:8px; margin-top:8px;">
|
<div style="display:flex; flex-wrap:wrap; gap:8px; margin-top:8px;">
|
||||||
{% for s in top_subjects %}
|
{% for s in top_subjects %}
|
||||||
@ -52,7 +52,7 @@
|
|||||||
<span class="muted">No subjects.</span>
|
<span class="muted">No subjects.</span>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Scripture usage -->
|
<!-- Scripture usage -->
|
||||||
<div class="card" style="padding:16px; margin-bottom:16px;">
|
<div class="card" style="padding:16px; margin-bottom:16px;">
|
||||||
@ -87,160 +87,8 @@
|
|||||||
<li class="muted">No data yet.</li>
|
<li class="muted">No data yet.</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ol>
|
</ol>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Tools: collapsible panel -->
|
|
||||||
<div class="card" style="padding:16px; margin-bottom:24px;">
|
|
||||||
<div style="display:flex; align-items:center; justify-content:space-between; gap:10px;">
|
|
||||||
<div class="meta-label">Maintenance Tools</div>
|
|
||||||
<button
|
|
||||||
class="btn btn-secondary"
|
|
||||||
type="button"
|
|
||||||
id="tools-toggle"
|
|
||||||
aria-expanded="false"
|
|
||||||
aria-controls="tools-panel"
|
|
||||||
>
|
|
||||||
▾ Show tools
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="tools-panel" class="tools-panel" hidden>
|
|
||||||
<!-- Scripture Normalizer -->
|
|
||||||
<div class="tool-block">
|
|
||||||
<h4>Scripture Normalizer</h4>
|
|
||||||
<p class="small muted">
|
|
||||||
Standardizes Bible references (book abbreviations, separators, and repeats book names as needed).
|
|
||||||
Use preview first; Apply will modify all <code>scripture_raw</code> fields.
|
|
||||||
</p>
|
|
||||||
<div class="tool-actions">
|
|
||||||
<form method="get" action="{% url 'normalize_scripture' %}" class="inline">
|
|
||||||
<input type="number" min="0" name="limit" placeholder="Preview limit (optional)"
|
|
||||||
class="tool-input">
|
|
||||||
<button class="btn btn-secondary">Preview (dry‑run)</button>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
{% if user.is_authenticated and user.is_staff %}
|
|
||||||
<form method="post" action="{% url 'normalize_scripture' %}" class="inline">
|
|
||||||
{% csrf_token %}
|
|
||||||
<button class="btn btn-danger"
|
|
||||||
onclick="return confirm('Apply Scripture Normalizer to ALL entries? This will modify scripture_raw fields.');">
|
|
||||||
Apply to all
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<hr class="tool-sep">
|
|
||||||
|
|
||||||
<!-- Source Normalizer -->
|
|
||||||
<div class="tool-block">
|
|
||||||
<h4>Source Normalizer</h4>
|
|
||||||
<p class="small muted">
|
|
||||||
Converts Watchtower/Awake!/Yearbook/KM references (e.g., “March 15, 2013 WT page 14”) into WOL short‑codes
|
|
||||||
like <code>w13 3/15 p.14</code>. Non‑JW sources are left unchanged. Use preview first; Apply will modify all
|
|
||||||
<code>source</code> fields.
|
|
||||||
</p>
|
|
||||||
<div class="tool-actions">
|
|
||||||
<form method="get" action="{% url 'normalize_source' %}" class="inline">
|
|
||||||
<input type="number" min="0" name="limit" placeholder="Preview limit (optional)"
|
|
||||||
class="tool-input">
|
|
||||||
<button class="btn btn-secondary">Preview (dry‑run)</button>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
{% if user.is_authenticated and user.is_staff %}
|
|
||||||
<form method="post" action="{% url 'normalize_source' %}" class="inline">
|
|
||||||
{% csrf_token %}
|
|
||||||
<button class="btn btn-danger"
|
|
||||||
onclick="return confirm('Apply Source Normalizer to ALL entries? This cannot be undone. Make a backup first.');">
|
|
||||||
Apply to all
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<hr class="tool-sep">
|
|
||||||
<div class="tool-card">
|
|
||||||
<h4 style="margin:0 0 6px;">Subject Normalizer</h4>
|
|
||||||
<p class="small muted" style="margin:0 0 8px;">
|
|
||||||
Normalize the <strong>Subject</strong> field so individual subjects are comma-separated.
|
|
||||||
Preserves multi-word subjects; lightly fixes separators like “;” and spaced dashes.
|
|
||||||
Uses your <code>subjects.txt</code> catalog when available.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<form method="get" action="{% url 'normalize_subjects' %}" style="display:inline;">
|
|
||||||
<input type="number" min="0" name="limit"
|
|
||||||
placeholder="Preview limit (optional)"
|
|
||||||
style="border:1px solid var(--border); border-radius:8px; padding:6px 8px;">
|
|
||||||
<button class="btn">Dry-run Preview</button>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
{% if user.is_authenticated and user.is_staff %}
|
|
||||||
<form method="post" action="{% url 'normalize_subjects' %}" style="display:inline; margin-left:8px;">
|
|
||||||
{% csrf_token %}
|
|
||||||
<button class="btn btn-danger"
|
|
||||||
onclick="return confirm('Apply subject normalization to all entries? This cannot be undone. Make a backup first.')">
|
|
||||||
Apply to All
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Tiny, scoped styles + JS for the collapsible panel -->
|
|
||||||
<style>
|
|
||||||
.tools-panel{
|
|
||||||
margin-top:12px;
|
|
||||||
border:1px solid var(--border);
|
|
||||||
border-radius:12px;
|
|
||||||
background:#fff;
|
|
||||||
padding:14px;
|
|
||||||
}
|
|
||||||
.tool-block h4{
|
|
||||||
margin:0 0 6px;
|
|
||||||
font-size:16px;
|
|
||||||
color:#0f172a;
|
|
||||||
}
|
|
||||||
.tool-actions{
|
|
||||||
display:flex;
|
|
||||||
flex-wrap:wrap;
|
|
||||||
gap:10px;
|
|
||||||
margin-top:8px;
|
|
||||||
}
|
|
||||||
.tool-input{
|
|
||||||
border:1px solid var(--border);
|
|
||||||
border-radius:8px;
|
|
||||||
padding:6px 8px;
|
|
||||||
font-size:14px;
|
|
||||||
margin-right:6px;
|
|
||||||
}
|
|
||||||
.tool-sep{
|
|
||||||
border:none;
|
|
||||||
border-top:1px solid var(--border);
|
|
||||||
margin:14px 0;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<script>
|
|
||||||
(function(){
|
|
||||||
var btn = document.getElementById('tools-toggle');
|
|
||||||
var panel = document.getElementById('tools-panel');
|
|
||||||
if(!btn || !panel) return;
|
|
||||||
btn.addEventListener('click', function(){
|
|
||||||
var open = panel.hasAttribute('hidden') ? false : true;
|
|
||||||
if(open){
|
|
||||||
panel.setAttribute('hidden', '');
|
|
||||||
btn.textContent = '▾ Show tools';
|
|
||||||
btn.setAttribute('aria-expanded', 'false');
|
|
||||||
}else{
|
|
||||||
panel.removeAttribute('hidden');
|
|
||||||
btn.textContent = '▴ Hide tools';
|
|
||||||
btn.setAttribute('aria-expanded', 'true');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
})();
|
|
||||||
</script>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
Loading…
Reference in New Issue
Block a user