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
+76
View File
@@ -0,0 +1,76 @@
{% extends "base.html" %}
{% block title %}{{ _('Admin · %(t)s', t=_('Edit ad') if ad else _('New ad')) }}{% endblock %}
{% block content %}
{% include "admin/_nav.html" %}
<div class="card">
<h2>{{ _('Edit ad') if ad else _('New ad') }}</h2>
{% if error %}<p class="alert danger">{{ error }}</p>{% endif %}
<form method="post" class="settings-panel">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<div class="field">
<label>{{ _('Advertiser name') }} *</label>
<input class="input" name="advertiser_name" required
value="{{ ad.advertiser_name if ad else '' }}">
</div>
<div class="field">
<label>{{ _('Slot') }} *</label>
<select class="input" name="slot" required>
{% for s in ['header', 'sidebar', 'inline', 'footer'] %}
<option value="{{ s }}" {{ 'selected' if ad and ad.slot == s }}>{{ s }}</option>
{% endfor %}
</select>
</div>
<div class="field">
<label>{{ _('Target URL') }} *</label>
<input class="input" name="target_url" required
value="{{ ad.target_url if ad else '' }}">
</div>
<div class="field">
<label>{{ _('Creative path (relative under media/ads/)') }}</label>
<input class="input" name="creative_path"
value="{{ ad.creative_path or '' if ad else '' }}"
placeholder="{{ _('e.g. banner.jpg — leave blank for text-only ad') }}">
</div>
<div class="field">
<label>{{ _('Alt text') }}</label>
<input class="input" name="alt_text" value="{{ ad.alt_text or '' if ad else '' }}">
</div>
<div class="field">
<label>{{ _('Language targeting (blank = all)') }}</label>
<select class="input" name="lang">
<option value="">{{ _('All') }}</option>
{% for l in ['en', 'vi', 'es'] %}
<option value="{{ l }}" {{ 'selected' if ad and ad.lang == l }}>{{ l }}</option>
{% endfor %}
</select>
</div>
<div class="field">
<label>{{ _('State targeting (2-letter, blank = all)') }}</label>
<input class="input" name="geo_state" maxlength="2"
value="{{ ad.geo_state or '' if ad else '' }}" placeholder="CA">
</div>
<div class="field">
<label>{{ _('Starts at (YYYY-MM-DD)') }}</label>
<input class="input" name="starts_at" type="date"
value="{{ ad.starts_at.strftime('%Y-%m-%d') if ad else '' }}">
</div>
<div class="field">
<label>{{ _('Ends at (YYYY-MM-DD)') }}</label>
<input class="input" name="ends_at" type="date"
value="{{ ad.ends_at.strftime('%Y-%m-%d') if ad else '' }}">
</div>
<div class="check">
<input type="checkbox" name="is_active" id="is_active"
{{ 'checked' if (not ad or ad.is_active) }}>
<label for="is_active">{{ _('Active') }}</label>
</div>
<div class="billing-actions">
<button class="btn" type="submit">{{ _('Save') }}</button>
<a class="btn ghost" href="{{ url_for('admin.admin_ads') }}">{{ _('Cancel') }}</a>
</div>
</form>
</div>
{% endblock %}