06/16 Phase 6 (continue)

This commit is contained in:
2026-06-17 17:51:03 -04:00
parent 68a842d6b6
commit d1383a9835
11 changed files with 846 additions and 5 deletions
+64
View File
@@ -0,0 +1,64 @@
{% extends "base.html" %}
{% block title %}{{ _('Admin · Ads') }}{% endblock %}
{% block content %}
{% include "admin/_nav.html" %}
<div class="card">
<div style="display:flex;justify-content:space-between;align-items:center">
<h2>{{ _('Ads') }}</h2>
<a class="btn" href="{{ url_for('admin.admin_ad_new') }}">{{ _('+ New ad') }}</a>
</div>
{% if not ad_list %}<p class="muted">{{ _('No ads yet.') }}</p>{% endif %}
<table class="list">
<thead><tr>
<th>{{ _('Advertiser') }}</th>
<th>{{ _('Slot') }}</th>
<th>{{ _('Targeting') }}</th>
<th>{{ _('Schedule') }}</th>
<th>{{ _('Imp.') }}</th>
<th>{{ _('Clicks') }}</th>
<th>{{ _('CTR') }}</th>
<th>{{ _('Status') }}</th>
<th></th>
</tr></thead>
{% for ad in ad_list %}
<tr>
<td><a href="{{ url_for('admin.admin_ad_edit', ad_id=ad.id) }}">{{ ad.advertiser_name }}</a></td>
<td><span class="badge cat">{{ ad.slot }}</span></td>
<td class="muted small">
{% if ad.lang %}lang={{ ad.lang }}{% endif %}
{% if ad.geo_state %} state={{ ad.geo_state }}{% endif %}
{% if not ad.lang and not ad.geo_state %}—{% endif %}
</td>
<td class="muted small">
{{ ad.starts_at.strftime('%Y-%m-%d') }}
{{ ad.ends_at.strftime('%Y-%m-%d') }}
</td>
<td>{{ ad.impressions }}</td>
<td>{{ ad.clicks }}</td>
<td>{{ ad.ctr }}%</td>
<td>
{% if ad.is_running %}
<span class="badge ok">{{ _('Live') }}</span>
{% elif ad.is_active %}
<span class="badge cat">{{ _('Scheduled') }}</span>
{% else %}
<span class="badge warn">{{ _('Off') }}</span>
{% endif %}
</td>
<td>
<form method="post" action="{{ url_for('admin.admin_ad_toggle', ad_id=ad.id) }}" style="display:inline">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button class="btn ghost tiny" type="submit">{{ _('Toggle') }}</button>
</form>
<form method="post" action="{{ url_for('admin.admin_ad_delete', ad_id=ad.id) }}" style="display:inline"
onsubmit="return confirm('{{ _('Delete this ad?') }}');">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button class="btn danger tiny" type="submit">{{ _('Del') }}</button>
</form>
</td>
</tr>
{% endfor %}
</table>
</div>
{% endblock %}