You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
2.9 KiB
74 lines
2.9 KiB
{% extends "base.html" %}
|
|
|
|
{% block title %}HappyWedding{% endblock %}
|
|
|
|
{% block content %}
|
|
<section class="mb-5">
|
|
<div class="flex items-center justify-between gap-3">
|
|
<h2 class="page-title">分享链接</h2>
|
|
<span class="status-badge status-badge-muted">{{ link_rows|length }} 个</span>
|
|
</div>
|
|
</section>
|
|
|
|
<section class="mb-5 card">
|
|
<div class="card-body">
|
|
<form action="{{ url_for('admin.share_links') }}" method="post" class="grid grid-cols-1 gap-4 lg:grid-cols-4">
|
|
<div class="lg:col-span-2">
|
|
<label for="label" class="form-label">备注名(可选)</label>
|
|
<input id="label" name="label" type="text" class="form-input" value="{{ form_data.label }}">
|
|
</div>
|
|
<div>
|
|
<label for="expire_days" class="form-label">有效期(天)</label>
|
|
<input id="expire_days" name="expire_days" type="number" min="1" max="365" class="form-input" value="{{ form_data.expire_days or default_expire_days }}" required>
|
|
</div>
|
|
<div class="flex items-end">
|
|
<button type="submit" class="btn btn-primary w-full">创建分享链接</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</section>
|
|
|
|
<section class="table-container">
|
|
<div class="overflow-x-auto">
|
|
<table class="min-w-full text-left text-sm">
|
|
<thead class="table-header">
|
|
<tr>
|
|
<th class="px-4 py-3">状态</th>
|
|
<th class="px-4 py-3">备注</th>
|
|
<th class="px-4 py-3">链接</th>
|
|
<th class="px-4 py-3">过期时间</th>
|
|
<th class="px-4 py-3">操作</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for row in link_rows %}
|
|
{% set link = row.link %}
|
|
<tr class="table-row">
|
|
<td class="px-4 py-3">{{ row.status_label }}</td>
|
|
<td class="px-4 py-3">{{ link.label or '-' }}</td>
|
|
<td class="px-4 py-3">
|
|
<a class="text-brand-600 underline dark:text-brand-400" href="{{ '/s/' ~ link.token }}" target="_blank" rel="noreferrer">
|
|
{{ row.public_url }}
|
|
</a>
|
|
</td>
|
|
<td class="px-4 py-3">{{ link.expires_at.strftime('%Y-%m-%d %H:%M') if link.expires_at else '-' }}</td>
|
|
<td class="px-4 py-3">
|
|
{% if not link.revoked_at %}
|
|
<form action="{{ url_for('admin.revoke_share_link_action', link_id=link.id) }}" method="post" class="inline">
|
|
<button type="submit" class="btn btn-secondary btn-sm">撤销</button>
|
|
</form>
|
|
{% else %}
|
|
<span class="text-xs text-neutral-500">-</span>
|
|
{% endif %}
|
|
</td>
|
|
</tr>
|
|
{% else %}
|
|
<tr>
|
|
<td colspan="5" class="empty-state">暂无分享链接</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</section>
|
|
{% endblock %}
|
|
|