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

65 lines
3.2 KiB
HTML

{% extends "base.html" %}
{% block title %}میرورها{% endblock %}
{% block content %}
<div class="d-flex justify-content-between align-items-center mb-4">
<h2>مدیریت میرورها</h2>
<div>
<a href="{{ url_for('mirrors.create') }}" class="btn btn-primary">+ میرور جدید</a>
<a href="{{ url_for('mirrors.results') }}" class="btn btn-outline-secondary">نتایج تست</a>
</div>
</div>
<div class="btn-group mb-3 flex-wrap" role="group">
<a href="{{ url_for('mirrors.list_mirrors') }}" class="btn btn-sm {% if not current_category %}btn-dark{% else %}btn-outline-dark{% endif %}">همه</a>
{% for cat in categories %}
<a href="{{ url_for('mirrors.list_mirrors', category=cat) }}" class="btn btn-sm {% if current_category == cat %}btn-dark{% else %}btn-outline-dark{% endif %}">
{{ category_labels[cat] }}
</a>
{% endfor %}
</div>
{% if current_category and guides.get(current_category) %}
<div class="alert alert-info d-flex justify-content-between">
<span>{{ guides[current_category].summary }}</span>
<a href="{{ url_for('main.guide', section=current_category) }}" class="alert-link">راهنمای {{ guides[current_category].title }}</a>
</div>
{% endif %}
<form method="post" action="{{ url_for('mirrors.test_all') }}" class="mb-3">
{% if current_category %}<input type="hidden" name="category" value="{{ current_category }}">{% endif %}
<button type="submit" class="btn btn-sm btn-info">تست همه{% if current_category %} {{ category_labels[current_category] }}{% endif %}</button>
</form>
<div class="table-responsive">
<table class="table table-hover align-middle">
<thead class="table-light">
<tr>
<th>دسته</th><th>نام</th><th>URL / IP</th><th>اولویت</th><th>فعال</th><th>عملیات</th>
</tr>
</thead>
<tbody>
{% for m in mirrors %}
<tr>
<td><span class="badge bg-secondary">{{ category_labels.get(m.category, m.category) }}</span></td>
<td>{{ m.name }}</td>
<td><code class="small">{{ m.url or m.ips or '-' }}</code></td>
<td>{{ m.priority }}</td>
<td>{% if m.enabled %}<span class="text-success">بله</span>{% else %}<span class="text-muted">خیر</span>{% endif %}</td>
<td>
<form method="post" action="{{ url_for('mirrors.test_one', mirror_id=m.id) }}" class="d-inline">
<button type="submit" class="btn btn-sm btn-outline-info">تست</button>
</form>
<a href="{{ url_for('mirrors.edit', mirror_id=m.id) }}" class="btn btn-sm btn-outline-primary">ویرایش</a>
<form method="post" action="{{ url_for('mirrors.delete', mirror_id=m.id) }}" class="d-inline" onsubmit="return confirm('حذف شود؟')">
<button type="submit" class="btn btn-sm btn-outline-danger">حذف</button>
</form>
</td>
</tr>
{% else %}
<tr><td colspan="6" class="text-center text-muted">میروری یافت نشد</td></tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock %}