detail.html 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. {% extends 'base.html' %}
  2. {% block titleBlock %}
  3. 文章详情页
  4. {% endblock %}
  5. {% block scriptBlock %}
  6. <script type="text/javascript" src="../../static/news/js/detail.js"></script>
  7. {% endblock %}
  8. {% block headerBlock %}
  9. <ul class="menu fl">
  10. {% for category in data.categories %}
  11. <li class="{% if loop.index0 == 0 %}active{% endif %}" data-cid="{{ category.id }}">
  12. <a href="javascript:;">{{ category.name }}</a>
  13. </li>
  14. {% endfor %}
  15. </ul>
  16. {% endblock %}
  17. {% block contentBlock %}
  18. <div class="detail_con fl">
  19. <h3>{{ data.news.title }}</h3>
  20. <div class="detail_about clearfix">
  21. <span class="time_souce fl">{{ data.news.create_time }} 来源: {{ data.news.source }}</span>
  22. <span class="comment fr">{{ data.news.comments_count }}</span>
  23. </div>
  24. {# safe表明内容是安全的需要解析输出 #}
  25. {{ data.news.content | safe }}
  26. <a href="javascript:;" class="collected block-center" data-newsid="{{ data.news.id }}"
  27. style="display: {% if data.is_collected %} block
  28. {% else %} none {% endif %};"><span class="out">已收藏</span><span class="over">取消收藏</span></a>
  29. <a href="javascript:;" class="collection block-center" data-newsid="{{ data.news.id }}"
  30. style="display: {% if data.is_collected %} none
  31. {% else %} block {% endif %};">收藏</a>
  32. {% if data.user_info %}
  33. <form action="" class="comment_form" data-newsid="{{ data.news.id }}">
  34. <div class="person_pic">
  35. <img src="../../static/news/images/cat.jpg" alt="用户图标">
  36. </div>
  37. <textarea placeholder="请发表您的评论" class="comment_input"></textarea>
  38. <input type="submit" name="" value="评 论" class="comment_sub">
  39. </form>
  40. {% else %}
  41. <div class="comment_form_logout">
  42. 登录发表你的评论
  43. </div>
  44. {% endif %}
  45. <div class="comment_count">
  46. {{ data.news.comments_count }}条评论
  47. </div>
  48. <div class="comment_list_con">
  49. {% for comment in data.comments %}
  50. <div class="comment_list">
  51. <div class="person_pic fl">
  52. <img src="{% if comment.user.avatar_url %}
  53. {{ comment.user.avatar_url }}
  54. {% else %}
  55. ../../static/news/images/person01.png
  56. {% endif %}" alt="用户图标">
  57. </div>
  58. <div class="user_name fl">{{ comment.user.nick_name }}</div>
  59. <div class="comment_text fl">{{ comment.content }}</div>
  60. {% if comment.parent %}
  61. <div class="reply_text_con fl">
  62. <div class="user_name2">{{ comment.parent.user.nick_name }}</div>
  63. <div class="reply_text">
  64. {{ comment.parent.content }}
  65. </div>
  66. </div>
  67. {% endif %}
  68. <div class="comment_time fl">{{ comment.create_time }}</div>
  69. <a href="javascript:;" class="comment_up
  70. {% if comment.is_like %}
  71. has_comment_up
  72. {% endif %} fr"
  73. data-commentid="{{ comment.id }}"
  74. data-likecount="{{ comment.like_count }}"
  75. data-newsid="{{ data.news.id }}">
  76. {% if comment.like_count > 0 %}
  77. {{ comment.like_count }}
  78. {% else %}
  79. {% endif %}</a>
  80. <a href="javascript:;" class="comment_reply fr">回复</a>
  81. <form class="reply_form fl" data-commentid="{{ comment.id }}" data-newsid="{{ data.news.id }}">
  82. <textarea class="reply_input"></textarea>
  83. <input type="button" value="回复" class="reply_sub fr">
  84. <input type="reset" name="" value="取消" class="reply_cancel fr">
  85. </form>
  86. </div>
  87. {% endfor %}
  88. </div>
  89. </div>
  90. {% endblock %}
  91. {% block authorBlock %}
  92. <div class="author_card">
  93. <a href="#" class="author_pic"><img src="../../static/news/images/user_pic.png" alt="author_pic"></a>
  94. <a href="#" class="author_name">张大山</a>
  95. <div class="author_resume">张大山的简介,张大山</div>
  96. <div class="writings"><span>总篇数</span><b>23</b></div>
  97. <div class="follows"><span>粉丝</span><b>36</b></div>
  98. <a href="javascript:;" class="focus fr">关注</a>
  99. <a href="javascript:;" class="focused fr"><span class="out">已关注</span><span class="over">取消关注</span></a>
  100. </div>
  101. {% endblock %}