Replaced monolithic modules/ package with a clean architecture:
- core/ config.py, utils.py
- ai/ models.py (ResilientModel), setup.py (init_models)
- story/ planner.py, writer.py, editor.py, style_persona.py, bible_tracker.py
- marketing/ cover.py, blurb.py, fonts.py, assets.py
- export/ exporter.py
- web/ app.py (Flask factory), db.py, helpers.py, tasks.py, routes/{auth,project,run,persona,admin}.py
- cli/ engine.py (run_generation), wizard.py (BookWizard)
Flask routes split into 5 Blueprints; all templates updated with blueprint-
prefixed url_for() calls. Dockerfile and docker-compose updated to use
web.app entry point and new package paths.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
114 lines
5.3 KiB
HTML
114 lines
5.3 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% block content %}
|
|
<div class="row mb-4">
|
|
<div class="col-md-8">
|
|
<h2><i class="fas fa-shield-alt me-2 text-warning"></i>Admin Dashboard</h2>
|
|
<p class="text-muted">System management and user administration.</p>
|
|
</div>
|
|
<div class="col-md-4 text-end">
|
|
<a href="{{ url_for('admin.admin_spend_report') }}" class="btn btn-outline-primary me-2"><i class="fas fa-chart-line me-2"></i>Spend Report</a>
|
|
<a href="{{ url_for('project.index') }}" class="btn btn-outline-secondary">Back to Dashboard</a>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<!-- User Management -->
|
|
<div class="col-md-6 mb-4">
|
|
<div class="card shadow-sm h-100">
|
|
<div class="card-header bg-light">
|
|
<h5 class="mb-0"><i class="fas fa-users me-2"></i>Users ({{ users|length }})</h5>
|
|
</div>
|
|
<div class="card-body p-0">
|
|
<div class="table-responsive">
|
|
<table class="table table-hover mb-0">
|
|
<thead class="table-light">
|
|
<tr>
|
|
<th>ID</th>
|
|
<th>Username</th>
|
|
<th>Role</th>
|
|
<th>Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for u in users %}
|
|
<tr>
|
|
<td>{{ u.id }}</td>
|
|
<td>{{ u.username }}</td>
|
|
<td>
|
|
{% if u.is_admin %}<span class="badge bg-warning text-dark">Admin</span>{% else %}<span class="badge bg-secondary">User</span>{% endif %}
|
|
</td>
|
|
<td>
|
|
{% if u.id != current_user.id %}
|
|
<form action="/admin/user/{{ u.id }}/delete" method="POST" onsubmit="return confirm('Delete user {{ u.username }} and ALL their projects? This cannot be undone.');">
|
|
<a href="{{ url_for('admin.impersonate_user', user_id=u.id) }}" class="btn btn-sm btn-outline-dark me-1" title="Impersonate User">
|
|
<i class="fas fa-user-secret"></i>
|
|
</a>
|
|
<button class="btn btn-sm btn-outline-danger" title="Delete User"><i class="fas fa-trash"></i></button>
|
|
</form>
|
|
{% else %}
|
|
<span class="text-muted small">Current</span>
|
|
{% endif %}
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- System Stats & Reset -->
|
|
<div class="col-md-6 mb-4">
|
|
<div class="card shadow-sm mb-4">
|
|
<div class="card-header bg-light">
|
|
<h5 class="mb-0"><i class="fas fa-sliders-h me-2"></i>Configuration</h5>
|
|
</div>
|
|
<div class="card-body">
|
|
<p class="text-muted small">Manage global AI writing rules and banned words.</p>
|
|
<a href="{{ url_for('admin.admin_style_guidelines') }}" class="btn btn-outline-primary w-100"><i class="fas fa-spell-check me-2"></i>Edit Style Guidelines</a>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card shadow-sm mb-4">
|
|
<div class="card-header bg-light">
|
|
<h5 class="mb-0"><i class="fas fa-chart-pie me-2"></i>System Stats</h5>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="row text-center">
|
|
<div class="col-6 mb-3">
|
|
<h3>{{ projects|length }}</h3>
|
|
<span class="text-muted">Total Projects</span>
|
|
</div>
|
|
<div class="col-6 mb-3">
|
|
<h3>{{ users|length }}</h3>
|
|
<span class="text-muted">Total Users</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card shadow-sm border-danger">
|
|
<div class="card-header bg-danger text-white">
|
|
<h5 class="mb-0"><i class="fas fa-exclamation-triangle me-2"></i>Danger Zone</h5>
|
|
</div>
|
|
<div class="card-body">
|
|
<p><strong>Factory Reset:</strong> This will delete <strong>ALL</strong> projects, books, and users (except your admin account). It resets the system to a fresh state.</p>
|
|
|
|
<form action="/admin/reset" method="POST" onsubmit="return confirmReset()">
|
|
<button type="submit" class="btn btn-danger w-100">
|
|
<i class="fas fa-radiation me-2"></i>Perform Factory Reset
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
function confirmReset() {
|
|
return confirm("⚠️ WARNING: This will wipe ALL data on the server except your account.\n\nAre you absolutely sure?");
|
|
}
|
|
</script>
|
|
{% endblock %} |