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.

87 lines
4.0 KiB

3 years ago
  1. {% extends 'admin/index.html' %}
  2. {% from 'bootstrap/pagination.html' import render_pagination %}
  3. {% block title %}Manage Photos{% endblock %}
  4. {% block content %}
  5. <nav aria-label="breadcrumb">
  6. <ol class="breadcrumb">
  7. {{ render_breadcrumb_item('admin.index', '控制板主页') }}
  8. {{ render_breadcrumb_item('admin.manage_photo', '管理照片') }}
  9. </ol>
  10. </nav>
  11. <div class="page-header">
  12. <h1>照片
  13. <small class="text-muted">{{ pagination.total }}</small>
  14. <span class="dropdown">
  15. <button class="btn btn-secondary btn-sm" type="button" id="dropdownMenuButton" data-toggle="dropdown"
  16. aria-haspopup="true" aria-expanded="false">
  17. Order by {{ order_rule }} <span class="oi oi-elevator"></span>
  18. </button>
  19. <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
  20. {% if order_rule == 'flag' %}
  21. <a class="dropdown-item" href="{{ url_for('.manage_photo', order='by_time') }}">按照时间顺序</a>
  22. {% else %}
  23. <a class="dropdown-item" href="{{ url_for('.manage_photo', order='by_flag') }}">按照标志排序</a>
  24. {% endif %}
  25. </div>
  26. </span>
  27. </h1>
  28. </div>
  29. {% if photos %}
  30. <table class="table table-striped">
  31. <thead>
  32. <tr>
  33. <th>照片</th>
  34. <th>描述</th>
  35. <th>标签</th>
  36. <th>作者</th>
  37. <th>报告</th>
  38. <th>日期</th>
  39. <th>操作</th>
  40. </tr>
  41. </thead>
  42. {% for photo in photos %}
  43. <tr>
  44. <td>
  45. <a href="{{ url_for('main.show_photo', photo_id=photo.id) }}">
  46. <img src="{{ url_for('main.get_image', filename=photo.filename_s) }}" width="250">
  47. </a>
  48. </td>
  49. <td>{{ photo.description }}</td>
  50. <td>
  51. {% if photo.tags %}
  52. {% for tag in photo.tags %}
  53. <form class="inline" method="post"
  54. action="{{ url_for('admin.delete_tag', tag_id=tag.id, next=request.full_path) }}">
  55. <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
  56. <button type="submit" class="btn badge badge-danger mb-1"
  57. onclick="return confirm('Are you sure?');">
  58. {{ tag.name }} <span class="oi oi-trash" aria-hidden="true">
  59. </span>
  60. </button>
  61. </form>
  62. {% endfor %}
  63. {% endif %}
  64. </td>
  65. <td>
  66. <a href="{{ url_for('user.index', username=photo.author.username) }}">{{ photo.author.name }}</a>
  67. </td>
  68. <td>{{ photo.flag }}</td>
  69. <td>{{ moment(photo.timestamp).format('LL') }}</td>
  70. <td>
  71. <form class="inline" method="post"
  72. action="{{ url_for('main.delete_photo', photo_id=photo.id, next=request.full_path) }}">
  73. <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
  74. <button type="submit" class="btn btn-danger btn-sm"
  75. onclick="return confirm('Are you sure?');">Delete
  76. </button>
  77. </form>
  78. </td>
  79. </tr>
  80. {% endfor %}
  81. </table>
  82. <div class="page-footer">{{ render_pagination(pagination) }}</div>
  83. {% else %}
  84. <div class="tip"><h5>无照片</h5></div>
  85. {% endif %}
  86. {% endblock %}