articles.html 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. {% extends "base.html" %}
  2. {% load static %}
  3. {% block title %}
  4. 文章
  5. {% endblock title %}
  6. {% block style %}
  7. <link rel="stylesheet" type="text/css" href="{% static 'article/list.css' %}">
  8. <link rel="stylesheet" type="text/css" href="{% static 'article/articles.css' %}">
  9. <link rel="stylesheet" type="text/css" href="{% static 'L_header.css' %}">
  10. {% endblock style %}
  11. {% block content %}
  12. <div class="container content-top" id="content">
  13. <hr>
  14. <div class="row article-top">
  15. <div class="mt-2 col-10" id="articles_list">
  16. {% if search %}
  17. {% if articles %}
  18. <h4>
  19. <span style="color: #0085a1">"{{ search }}"</span>的搜索结果如下:
  20. </h4>
  21. <hr>
  22. {% else %}
  23. <h4>
  24. 暂无
  25. <span style="color: #0085a1">"{{ search }}"</span>有关的文章。
  26. </h4>
  27. {% endif %}
  28. {% endif %}
  29. {% for article in articles %}
  30. <div class="row col-12">
  31. <!--标题图-->
  32. {% if article.avatar %}
  33. <div class="col-5" data-aos="fade-up" data-aos-delay="100">
  34. <img src="{{ article.avatar.url }}"
  35. alt="avatar"
  36. style="max-width: 100%; border-radius: 20px;"
  37. >
  38. </div>
  39. {% endif %}
  40. <div class="col-7">
  41. {% if article.column %}
  42. <button type="button"
  43. onclick="window.open('{% url 'article:article_list' %}?search={{ search }}&tag={{ tag }}&column={{ article.column.id }}')"
  44. class="btn btn-sm mb-2 column_button"
  45. data-aos="fade-up" data-aos-delay="120">
  46. {{ article.column }}
  47. </button>
  48. {% endif %}
  49. <!--标签-->
  50. <span>
  51. {% for tag in article.tags.all %}
  52. <a href="{% url 'article:article_list' %}?tag={{ tag }}&column={{ column }}"
  53. class="badge badge-secondary" data-aos="fade-up" data-aos-delay="120">
  54. {{ tag }}
  55. </a>
  56. {% endfor %}
  57. </span>
  58. <!--标题-->
  59. <h4 data-aos="fade-up" data-aos-delay="140">
  60. <b>
  61. <a id="post-preview" href="{% url 'article:article_detail' article.id %}">
  62. {{ article.title }}
  63. </a>
  64. </b>
  65. </h4>
  66. <!--摘要-->
  67. <div data-aos="fade-up" data-aos-delay="160">
  68. <p style="color: gray;">
  69. {{ article.summary|slice:'50' }}...
  70. </p>
  71. </div>
  72. <!--注脚-->
  73. <p style="color: #868e96;font-style: italic;font-family: 'Lora', 'Times New Roman', serif;"
  74. data-aos="fade-up" data-aos-delay="180">
  75. <!--附加消息-->
  76. <span>
  77. <i class="fas fa-eye"></i>
  78. {{ article.total_views }} viewd&nbsp;&nbsp;&nbsp;
  79. </span>
  80. <span>
  81. <i class="fas fa-comments"></i>
  82. Posted at {{ article.created|date:'Y-m-d' }}&nbsp;&nbsp;&nbsp;
  83. </span>
  84. <span>
  85. <i class="fas fa-clock"></i>
  86. Update at {{ article.updated|date:'Y-m-d' }}
  87. </span>
  88. </p>
  89. <hr data-aos="fade-up" data-aos-delay="180">
  90. </div>
  91. <hr style="width:100%;" data-aos="fade-up" data-aos-delay="180"/>
  92. </div>
  93. {% endfor %}
  94. </div>
  95. <div class="col-2 sidebar" id="sidebar">
  96. <div class="sidebar__inner">
  97. <div class="mt-2 col-2">
  98. <div class="m-auto middle">
  99. <a href="{% url 'article:article_list' %}?search={{ search }}&tag={{ tag }}&column={{ column }}">
  100. Latest
  101. </a>
  102. <div id="line"></div>
  103. <a href="{% url 'article:article_list' %}?order=total_views&search={{ search }}&tag={{ tag }}&column={{ column }}">
  104. Hottest
  105. </a>
  106. </div>
  107. </div>
  108. </div>
  109. </div>
  110. </div>
  111. <!--
  112. <div class="pagination row">
  113. <div class="m-auto">
  114. <span class="step-links">
  115. {% if articles.has_previous %}
  116. <a href="?page=1&order={{ order }}&search={{ search }}&tag={{ tag }}&column={{ column }}"
  117. class="btn btn-success">
  118. &laquo;1
  119. </a>
  120. <span>...</span>
  121. <a href="?page={{ articles.previous_page_number }}&order={{ order }}&search={{ search }}&tag=
  122. {{ tag }}&column={{ column }}"
  123. class="btn btn-secondary">
  124. {{ articles.previous_page_number }}
  125. </a>
  126. {% endif %}
  127. <span class="current btn btn-danger btn-lg">
  128. {{ articles.number }}
  129. </span>
  130. {% if articles.has_next %}
  131. <a href="?page={{ articles.next_page_number }}&order={{ order }}&search={{ search }}&tag={{ tag }}
  132. &column={{ column }}"
  133. class="btn btn-secondary">
  134. {{ articles.next_page_number }}
  135. </a>
  136. <span>...</span>
  137. <a href="?page={{ articles.paginator.num_pages }}&order={{ order }}&search={{ search }}&tag=
  138. {{ tag }}&column={{ column }}"
  139. class="btn btn-success">
  140. {{ articles.paginator.num_pages }} &raquo
  141. </a>
  142. {% endif %}
  143. </span>
  144. </div>
  145. </div>-->
  146. </div>
  147. {% endblock content %}
  148. {% block script %}
  149. <script src="{% static 'typed/typed.js' %}"></script>
  150. <script src="{% static 'article/jquery.cookie.js' %}"></script>
  151. <script src="{% static 'sticky_sidebar/jquery.sticky-sidebar.min.js' %}"></script>
  152. <script>
  153. let tag="{{ tag }}";
  154. let search="{{ search }}";
  155. let order="{{ order }}";
  156. let column="{{ column }}";
  157. </script>
  158. <script src="{% static 'article/articles.js' %}"></script>
  159. {% endblock script %}