article.html 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. {% extends 'management/_common/base.html' %}
  2. {% load page_tag %}
  3. {% block content %}
  4. <form style="padding: 0;" action="/management/article" method="get">
  5. <div style="padding: 0" class="ui input">
  6. <input name="search_title" type="text" style="margin-right: 5px" placeholder="标题">
  7. <input name='search_content' type="text" style="margin-right: 5px" placeholder="内容">
  8. <button type="submit" class="ui button primary"><i class="search icon"></i>搜索</button>
  9. <a href="/management/article" type="reset" class="ui button secondary"><i class="refresh icon"></i>重置</a>
  10. </div>
  11. </form>
  12. <table style="padding: 0" class="ui celled table">
  13. <thead>
  14. <tr>
  15. <th>封面</th>
  16. <th>标题</th>
  17. <th>分类</th>
  18. <th>创建时间</th>
  19. <th>置顶</th>
  20. <th>状态</th>
  21. <th>操作</th>
  22. </tr>
  23. </thead>
  24. <tbody>
  25. {% for article in articles %}
  26. <tr>
  27. <td>{{ article.cover__file_net_path }}</td>
  28. <td><a href="/management/article/to_edit/{{ article.id }}">{{ article.title }}</a></td>
  29. <td>{{ article.category__name }}</td>
  30. <td>{{ article.created_time }}</td>
  31. <td>{{ article.is_top }}</td>
  32. <td>{% if article.status == 1 %}
  33. <strong style="color: green">发布</strong>
  34. {% elif article.status == 0 %}
  35. <strong style="color: orange">草稿</strong>
  36. {% endif %} </td>
  37. <td><a onclick="deleteConfirm({{ article.id }})" href="#" class="button" style="color: red">删除</a>
  38. </td>
  39. </tr>
  40. {% endfor %}
  41. </tbody>
  42. <tfoot>
  43. <tr>
  44. <th colspan="7">
  45. <div class="ui right floated pagination menu">
  46. {% if articles.number > 1 %}
  47. <a href="?page={{ articles.number|add:-1 }}" class="icon item">
  48. <i class="left chevron icon"></i>
  49. </a>
  50. {% else %}
  51. <a class="icon item">
  52. <i class="left chevron icon"></i>
  53. </a>
  54. {% endif %}
  55. {% for page in articles.paginator.page_range %}
  56. {% circle_page articles.number page %}
  57. {% endfor %}
  58. {% if articles.number < articles.paginator.num_pages %}
  59. <a href="?page={{ articles.number | add:1 }}" class="icon item">
  60. <i class="right chevron icon"></i>
  61. </a>
  62. {% else %}
  63. <a class="icon item">
  64. <i class="right chevron icon"></i>
  65. </a>
  66. {% endif %}
  67. </div>
  68. </th>
  69. </tr>
  70. </tfoot>
  71. </table>
  72. <div class="ui mini test modal">
  73. <div class="header">
  74. 警告
  75. </div>
  76. <div class="content">
  77. <p>确认删除该文章?</p>
  78. </div>
  79. <div class="actions">
  80. <div class="ui negative button">
  81. 取消
  82. </div>
  83. <a id="deleteBtn" href="" class="ui positive right labeled icon button">
  84. 确认
  85. <i class="checkmark icon"></i>
  86. </a>
  87. </div>
  88. </div>
  89. {% endblock %}
  90. {% block js %}
  91. <script>
  92. function deleteConfirm(id) {
  93. $('.mini.modal')
  94. .modal('show')
  95. $("#deleteBtn").attr('href', '/management/article/delete_article?id=' + id)
  96. }
  97. </script>
  98. {% endblock %}