109 lines
6.2 KiB
HTML
109 lines
6.2 KiB
HTML
{% extends "admin/base.html" %}
|
|
|
|
{% block main_content %}
|
|
<section class="form-panel">
|
|
<div class="table-head">
|
|
<div>
|
|
<h2>新增评价</h2>
|
|
<div class="table-note">这里创建的评价会立刻出现在前台 `/reviews` 页面。</div>
|
|
</div>
|
|
</div>
|
|
|
|
<form method="post" action="/admin/reviews" class="inline-form">
|
|
<div class="compact-grid">
|
|
<input type="text" name="title" placeholder="标题" value="{{ create_form.title }}" required>
|
|
<select name="review_type">
|
|
<option value="game" {% if create_form.review_type == "game" %}selected{% endif %}>游戏</option>
|
|
<option value="anime" {% if create_form.review_type == "anime" %}selected{% endif %}>动画</option>
|
|
<option value="music" {% if create_form.review_type == "music" %}selected{% endif %}>音乐</option>
|
|
<option value="book" {% if create_form.review_type == "book" %}selected{% endif %}>书籍</option>
|
|
<option value="movie" {% if create_form.review_type == "movie" %}selected{% endif %}>影视</option>
|
|
</select>
|
|
<input type="number" name="rating" min="0" max="5" value="{{ create_form.rating }}" required>
|
|
<input type="date" name="review_date" value="{{ create_form.review_date }}">
|
|
<select name="status">
|
|
<option value="completed" {% if create_form.status == "completed" %}selected{% endif %}>已完成</option>
|
|
<option value="in-progress" {% if create_form.status == "in-progress" %}selected{% endif %}>进行中</option>
|
|
<option value="dropped" {% if create_form.status == "dropped" %}selected{% endif %}>已弃坑</option>
|
|
</select>
|
|
<input type="text" name="cover" value="{{ create_form.cover }}" placeholder="封面图标或 emoji">
|
|
<input type="text" name="tags" value="{{ create_form.tags }}" placeholder="标签,逗号分隔">
|
|
<textarea name="description" placeholder="评价描述">{{ create_form.description }}</textarea>
|
|
</div>
|
|
<div class="compact-actions">
|
|
<button type="submit" class="btn btn-primary">创建评价</button>
|
|
</div>
|
|
</form>
|
|
</section>
|
|
|
|
<section class="table-panel">
|
|
<div class="table-head">
|
|
<div>
|
|
<h2>评价列表</h2>
|
|
<div class="table-note">这里的每一行都可以直接编辑,保存后前台评价页会读取最新数据。</div>
|
|
</div>
|
|
</div>
|
|
|
|
{% if rows | length > 0 %}
|
|
<div class="table-wrap">
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>ID</th>
|
|
<th>评价内容</th>
|
|
<th>状态</th>
|
|
<th>操作</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for row in rows %}
|
|
<tr>
|
|
<td class="mono">#{{ row.id }}</td>
|
|
<td>
|
|
<form method="post" action="/admin/reviews/{{ row.id }}/update" class="inline-form compact">
|
|
<div class="compact-grid">
|
|
<input type="text" name="title" value="{{ row.title }}" required>
|
|
<select name="review_type">
|
|
<option value="game" {% if row.review_type == "game" %}selected{% endif %}>游戏</option>
|
|
<option value="anime" {% if row.review_type == "anime" %}selected{% endif %}>动画</option>
|
|
<option value="music" {% if row.review_type == "music" %}selected{% endif %}>音乐</option>
|
|
<option value="book" {% if row.review_type == "book" %}selected{% endif %}>书籍</option>
|
|
<option value="movie" {% if row.review_type == "movie" %}selected{% endif %}>影视</option>
|
|
</select>
|
|
<input type="number" name="rating" min="0" max="5" value="{{ row.rating }}" required>
|
|
<input type="date" name="review_date" value="{{ row.review_date }}">
|
|
<select name="status">
|
|
<option value="completed" {% if row.status == "completed" %}selected{% endif %}>已完成</option>
|
|
<option value="in-progress" {% if row.status == "in-progress" %}selected{% endif %}>进行中</option>
|
|
<option value="dropped" {% if row.status == "dropped" %}selected{% endif %}>已弃坑</option>
|
|
</select>
|
|
<input type="text" name="cover" value="{{ row.cover }}" placeholder="封面图标或 emoji">
|
|
<input type="text" name="tags" value="{{ row.tags_input }}" placeholder="标签,逗号分隔">
|
|
<textarea name="description" placeholder="评价描述">{{ row.description }}</textarea>
|
|
</div>
|
|
<div class="compact-actions">
|
|
<button type="submit" class="btn btn-success">保存</button>
|
|
<a href="{{ row.api_url }}" class="btn btn-ghost" target="_blank" rel="noreferrer noopener">API</a>
|
|
</div>
|
|
</form>
|
|
</td>
|
|
<td><span class="chip">{{ row.status }}</span></td>
|
|
<td>
|
|
<div class="actions">
|
|
<a href="http://localhost:4321/reviews" class="btn btn-primary" target="_blank" rel="noreferrer noopener">前台查看</a>
|
|
<form method="post" action="/admin/reviews/{{ row.id }}/delete">
|
|
<button type="submit" class="btn btn-danger">删除</button>
|
|
</form>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{% else %}
|
|
<div class="empty">暂无评价数据。</div>
|
|
{% endif %}
|
|
</section>
|
|
{% endblock %}
|