article.html 4.2 KB

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