Initial commit
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
{% 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 %}
|
||||
@@ -0,0 +1,39 @@
|
||||
{% extends "base.html" %}
|
||||
{% from "macros.html" import guide_box %}
|
||||
{% block title %}پروفایلها{% endblock %}
|
||||
{% block content %}
|
||||
<div class="d-flex justify-content-between mb-4">
|
||||
<h2>پروفایلها</h2>
|
||||
<a href="{{ url_for('profiles.create') }}" class="btn btn-primary">+ پروفایل جدید</a>
|
||||
</div>
|
||||
{{ guide_box(guide, 'profiles') }}
|
||||
<div class="row g-3">
|
||||
{% for p in profiles %}
|
||||
<div class="col-md-4">
|
||||
<div class="card h-100 {% if p.is_default %}border-primary{% endif %}">
|
||||
<div class="card-body">
|
||||
<h5>{{ p.name }}{% if p.is_default %} <span class="badge bg-primary">پیشفرض</span>{% endif %}</h5>
|
||||
<p class="text-muted small">{{ p.description or '' }}</p>
|
||||
<ul class="list-unstyled small">
|
||||
{% for item in p.items %}
|
||||
<li>{{ item.category }}: <strong>{{ item.mirror.name if item.mirror else '-' }}</strong></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="card-footer bg-transparent">
|
||||
<a href="{{ url_for('profiles.edit', profile_id=p.id) }}" class="btn btn-sm btn-outline-primary">ویرایش</a>
|
||||
<form method="post" action="{{ url_for('apply.apply', profile_id=p.id) }}" class="d-inline">
|
||||
<input type="hidden" name="rollback_minutes" value="15">
|
||||
<button type="submit" class="btn btn-sm btn-success" onclick="return confirm('پروفایل اعمال شود؟ Docker restart میشود.')">اعمال</button>
|
||||
</form>
|
||||
<form method="post" action="{{ url_for('profiles.delete', profile_id=p.id) }}" class="d-inline" onsubmit="return confirm('حذف شود؟')">
|
||||
<button type="submit" class="btn btn-sm btn-outline-danger">حذف</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="col-12"><p class="text-muted">پروفایلی وجود ندارد</p></div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user