detail.html 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. {% extends "base.html" %}
  2. {% load static %}
  3. {% block title %}
  4. 文章详情:{{ article.title }}
  5. {% endblock title %}
  6. {% block style %}
  7. <link rel="stylesheet" href="{% static 'prism/prism.css' %}">
  8. <link rel="stylesheet" type="text/css" href="{% static 'article/detail.css' %}">
  9. {% endblock style %}
  10. {% block content %}
  11. <header class="masthead" id="masthead" style="background-image: url({{ article.avatar.url }}) !important;">
  12. <div class="overlay"></div>
  13. <div class="container">
  14. <div class="row">
  15. <div class="col-lg-12 col-md-10 mx-auto">
  16. <div class="site-heading no-gutter" data-aos="fade-up" data-aos-delay="100">
  17. <h1>{{ article.title }}</h1>
  18. <p>
  19. <span class="subheading text-slider-items">
  20. {{ article.summary }}
  21. </span><strong
  22. class="text-slider"></strong>
  23. </p>
  24. </div>
  25. </div>
  26. </div>
  27. </div>
  28. </header>
  29. <div class="container" id="content">
  30. <div class="row">
  31. <div class="col-8">
  32. <h1 class="mt-4 mb-4" data-aos="fade-up" data-aos-delay="100">
  33. {{ article.title }}
  34. </h1>
  35. <div class="col-12 alert alert-success" data-aos="fade-up" data-aos-delay="120">
  36. 作者: {{ article.author }}
  37. {% if user == article.author %}
  38. · <a href="#" onclick="confirm_delete()">
  39. 删除文章
  40. </a>
  41. · <a href="{% url 'article:article_update' article.id %}">
  42. 编辑文章
  43. </a>
  44. {% endif %}
  45. &nbsp;&nbsp;浏览:{{ article.total_views }}
  46. <form style="display: none"
  47. id="safe_delete"
  48. action="{% url 'article:article_safe_delete' article.id %}"
  49. method="post"
  50. >
  51. {% csrf_token %}
  52. <button type="submit">
  53. 发送
  54. </button>
  55. </form>
  56. </div>
  57. <div class="col-12" data-aos="fade-up" data-aos-delay="160">
  58. <p class="markdown_body">
  59. {{ article.body|safe }}
  60. </p>
  61. </div>
  62. <hr data-aos="fade-up" data-aos-delay="160">
  63. {# {% if user.is_authenticated %}#}
  64. {# <div data-aos="fade-up" data-aos-delay="140">#}
  65. {# <form action="{% url 'comment:post_comment' article.id %}" method="post">#}
  66. {# {% csrf_token %}#}
  67. {# <div class="form-group">#}
  68. {# <label for="body">#}
  69. {# <strong>#}
  70. {# 发表评论#}
  71. {# </strong>#}
  72. {# </label>#}
  73. {# <!--<textarea type="text" class="form-control" id="body" name="body" rows="2"></textarea>-->#}
  74. {# <div>#}
  75. {# {{ comment_form.media }}#}
  76. {# {{ comment_form.body }}#}
  77. {# </div>#}
  78. {# </div>#}
  79. {# <button type="submit" class="btn btn-primary">发送</button>#}
  80. {# </form>#}
  81. {# </div>#}
  82. {# <br>#}
  83. {# {% else %}#}
  84. {# <br>#}
  85. {# <h5 class="row justify-content-center" data-aos="fade-up" data-aos-delay="140">#}
  86. {# 请<a href="{% url 'userprofile:login' %}">登录</a>后回复#}
  87. {# </h5>#}
  88. {# <br>#}
  89. {# {% endif %}#}
  90. {# {% load mptt_tags %}#}
  91. {# <h4 data-aos="fade-up" data-aos-delay="160">共有{{ comments.count }}条评论</h4>#}
  92. {# <div class="row" data-aos="fade-up" data-aos-delay="180">#}
  93. {# <!-- 遍历树形结构 -->#}
  94. {# {% recursetree comments %}#}
  95. {# <!-- 给 node 取个别名 comment -->#}
  96. {# {% with comment=node %}#}
  97. {# <div class="{% if comment.reply_to %}#}
  98. {# offset-1 col-11#}
  99. {# {% else %}#}
  100. {# col-12#}
  101. {# {% endif %}">#}
  102. {# <hr>#}
  103. {# <p>#}
  104. {# <strong style="color: pink">#}
  105. {# {{ comment.user }}#}
  106. {# </strong>#}
  107. {# {% if comment.reply_to %}#}
  108. {# <i class="far fa-arrow-alt-circle-right"#}
  109. {# style="color: cornflowerblue;"#}
  110. {# ></i>#}
  111. {# <strong style="color: pink">#}
  112. {# {{ comment.reply_to }}#}
  113. {# </strong>#}
  114. {# {% endif %}#}
  115. {# </p>#}
  116. {# <div>{{ comment.body|safe }}</div>#}
  117. {# <div>#}
  118. {# <span style="color: gray">#}
  119. {# {{ comment.created|date:"Y-m-d H:i" }}#}
  120. {# </span>#}
  121. {# <!-- 加载 modal 的按钮 -->#}
  122. {# {% if user.is_authenticated %}#}
  123. {# <button type="button"#}
  124. {# class="btn btn-light btn-sm text-muted"#}
  125. {# onclick="load_modal({{ article.id }}, {{ comment.id }})">#}
  126. {# 回复#}
  127. {# </button>#}
  128. {# {% else %}#}
  129. {# <a class="btn btn-light btn-sm text-muted"#}
  130. {# href="{% url 'userprofile:login' %}">#}
  131. {# 回复#}
  132. {# </a>#}
  133. {# {% endif %}#}
  134. {# </div>#}
  135. {# <!-- Modal -->#}
  136. {# <div class="modal fade"#}
  137. {# id="comment_{{ comment.id }}"#}
  138. {# tabindex="-1"#}
  139. {# role="dialog"#}
  140. {# aria-labelledby="CommentModalCenter"#}
  141. {# aria-hidden="true">#}
  142. {# <div class="modal-dialog modal-dialog-centered modal-lg" role="document">#}
  143. {# <div class="modal-content" style="height: 480px">#}
  144. {# <div class="modal-header">#}
  145. {# <h5 class="modal-title" id="exampleModalCenterTitle">#}
  146. {# 回复 {{ comment.user }}:</h5>#}
  147. {# </div>#}
  148. {# <div class="modal-body" id="modal_body_{{ comment.id }}"></div>#}
  149. {# </div>#}
  150. {# </div>#}
  151. {# </div>#}
  152. {# {% if not comment.is_leaf_node %}#}
  153. {# <div class="children">#}
  154. {# {{ children }}#}
  155. {# </div>#}
  156. {# {% endif %}#}
  157. {# </div>#}
  158. {# {% endwith %}#}
  159. {# {% endrecursetree %}#}
  160. {# </div>#}
  161. </div>
  162. {% if toc_flag %}
  163. <div class="col-4 mt-5 sidebar" id="sidebar">
  164. <div class="sidebar__inner">
  165. <h4 data-aos="fade-up" data-aos-delay="100"><strong>目录</strong></h4>
  166. <hr>
  167. <div data-aos="fade-up" data-aos-delay="140" id="post-preview">
  168. {{ toc|safe }}
  169. </div>
  170. </div>
  171. </div>
  172. {% endif %}
  173. </div>
  174. </div>
  175. {% endblock content %}
  176. {% block script %}
  177. <script src="{% static 'ckeditor/ckeditor/plugins/prism/lib/prism/prism_patched.min.js' %}"></script>
  178. <script src="{% static 'sticky_sidebar/jquery.sticky-sidebar.min.js' %}"></script>
  179. <script src="{% static 'typed/typed.js' %}"></script>
  180. <script src="{% static 'article/detail.js' %}"></script>
  181. {% endblock script %}