Files
mirror/app/templates/profiles/form.html
T
2026-06-03 17:33:19 +03:30

42 lines
2.1 KiB
HTML

{% extends "base.html" %}
{% from "macros.html" import guide_box %}
{% block title %}{% if profile %}ویرایش{% else %}ایجاد{% endif %} پروفایل{% endblock %}
{% block content %}
<h2>{% if profile %}ویرایش پروفایل{% else %}پروفایل جدید{% endif %}</h2>
{{ guide_box(guide, 'profiles') }}
<form method="post" class="card p-4 mt-3">
<div class="mb-3">
<label class="form-label">نام پروفایل</label>
<input type="text" name="name" class="form-control" required value="{{ profile.name if profile else '' }}">
</div>
<div class="mb-3">
<label class="form-label">توضیحات</label>
<textarea name="description" class="form-control" rows="2">{{ profile.description if profile else '' }}</textarea>
</div>
<div class="form-check mb-4">
<input class="form-check-input" type="checkbox" name="is_default" id="is_default" {% if profile and profile.is_default %}checked{% endif %}>
<label class="form-check-label" for="is_default">پروفایل پیش‌فرض</label>
</div>
<h5>انتخاب میرور برای هر بخش</h5>
<p class="text-muted small">بخشی که انتخاب نکنید در apply نادیده گرفته می‌شود.</p>
<div class="row g-3">
{% for cat in categories %}
<div class="col-md-6">
<label class="form-label">{{ category_labels[cat] }}</label>
<select name="mirror_{{ cat }}" class="form-select">
<option value="">— انتخاب نشود —</option>
{% for m in mirrors_by_cat.get(cat, []) %}
<option value="{{ m.id }}" {% if current.get(cat) == m.id %}selected{% endif %}>{{ m.name }}</option>
{% endfor %}
</select>
<a href="{{ url_for('main.guide', section=cat) }}" class="small">راهنما</a>
</div>
{% endfor %}
</div>
<div class="mt-4">
<button type="submit" class="btn btn-primary">ذخیره</button>
<a href="{{ url_for('profiles.list_profiles') }}" class="btn btn-secondary">انصراف</a>
</div>
</form>
{% endblock %}