admin.html 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. {% extends "base.html" %}
  2. {% block title %}管理文章 - 个人博客{% endblock %}
  3. {% block content %}
  4. <div class="admin-container">
  5. <h1>文章管理</h1>
  6. {% if posts %}
  7. <table class="admin-table">
  8. <thead>
  9. <tr>
  10. <th>标题</th>
  11. <th>日期</th>
  12. <th>操作</th>
  13. </tr>
  14. </thead>
  15. <tbody>
  16. {% for post in posts %}
  17. <tr>
  18. <td>
  19. <a href="{{ url_for('view_post', post_id=post.id) }}">{{ post.title }}</a>
  20. </td>
  21. <td>{{ post.date[:10] }}</td>
  22. <td>
  23. <form method="POST" action="{{ url_for('delete_post', post_id=post.id) }}" onsubmit="return confirm('确定要删除「{{ post.title }}」吗?此操作不可恢复。');">
  24. <button type="submit" class="btn btn-danger">删除</button>
  25. </form>
  26. </td>
  27. </tr>
  28. {% endfor %}
  29. </tbody>
  30. </table>
  31. {% else %}
  32. <div class="empty-state">
  33. <p>还没有文章。</p>
  34. </div>
  35. {% endif %}
  36. </div>
  37. {% endblock %}