files.html 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. {% extends 'management/_common/base.html' %}
  2. {% load page_tag %}
  3. {% block content %}
  4. <form style="padding: 0;" action="/management/files" method="get">
  5. <div style="padding: 0" class="ui input">
  6. <input name="search_name" type="text" style="margin-right: 5px" placeholder="Name">
  7. <button type="submit" class="ui button primary"><i class="search icon"></i>搜索</button>
  8. <a href="/management/files" type="reset" class="ui button secondary"><i class="refresh icon"></i>重置</a>
  9. </div>
  10. </form>
  11. <table style="padding: 0" class="ui celled table">
  12. <thead>
  13. <tr>
  14. <th>ID</th>
  15. <th>预览</th>
  16. <th>源文件名称</th>
  17. <th>路径</th>
  18. <th>后缀</th>
  19. <th>操作</th>
  20. </tr>
  21. </thead>
  22. <tbody>
  23. {% for file in files %}
  24. <tr>
  25. <td>{{ file.id }}</td>
  26. <td>
  27. {% if file.suffix == 'jpg' or file.suffix == 'png' or file.suffix == 'gif' %}
  28. <img width="50" height="50" src="{{ file.file_net_path }}">
  29. {% else %}
  30. {% endif %}
  31. </td>
  32. <td>{{ file.file_net_path }}</td>
  33. <td>{{ file.origin_name }}</td>
  34. <td>{{ file.suffix }}</td>
  35. <td><a onclick="deleteConfirm({{ file.id }})" href="#" class="button" style="color: red">删除</a>
  36. </td>
  37. </tr>
  38. {% endfor %}
  39. </tbody>
  40. <tfoot>
  41. <tr>
  42. <th colspan="7">
  43. <div class="ui right floated pagination menu">
  44. {% if files.number > 1 %}
  45. <a href="?page={{ files.number|add:-1 }}" class="icon item">
  46. <i class="left chevron icon"></i>
  47. </a>
  48. {% else %}
  49. <a class="icon item">
  50. <i class="left chevron icon"></i>
  51. </a>
  52. {% endif %}
  53. {% for page in files.paginator.page_range %}
  54. {% circle_page files.number page %}
  55. {% endfor %}
  56. {% if files.number < files.paginator.num_pages %}
  57. <a href="?page={{ files.number | add:1 }}" class="icon item">
  58. <i class="right chevron icon"></i>
  59. </a>
  60. {% else %}
  61. <a class="icon item">
  62. <i class="right chevron icon"></i>
  63. </a>
  64. {% endif %}
  65. </div>
  66. </th>
  67. </tr>
  68. </tfoot>
  69. </table>
  70. <div class="ui mini test modal">
  71. <div class="header">
  72. 警告
  73. </div>
  74. <div class="content">
  75. <p>确认删除文件?</p>
  76. </div>
  77. <div class="actions">
  78. <div class="ui negative button">
  79. 取消
  80. </div>
  81. <a id="deleteBtn" href="" class="ui positive right labeled icon button">
  82. 确认
  83. <i class="checkmark icon"></i>
  84. </a>
  85. </div>
  86. </div>
  87. {% endblock %}
  88. {% block js %}
  89. <script>
  90. function deleteConfirm(id) {
  91. $('.mini.modal')
  92. .modal('show')
  93. $("#deleteBtn").attr('href', '/management/files/delete?id=' + id)
  94. }
  95. </script>
  96. {% endblock %}