replies.html 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <style>
  2. .like-active {
  3. color:#a40004;
  4. }
  5. .like-no-active {
  6. color:#ccc;
  7. }
  8. </style>
  9. <script type="text/javascript">
  10. var replyData = {
  11. 'like':"{{ url_for('mine.like') }}",
  12. }
  13. DoLike(replyData);
  14. </script>
  15. <div class="panel panel-default" id="replies-content">
  16. <div class="panel-heading">
  17. 共收到{{ replies.total }}条回复
  18. </div>
  19. {% if replies.items %}
  20. {% set num = 1 %}
  21. {% for reply in replies.items %}
  22. <div class="panel-body media" id="reply-{{ reply.id }}" style="border-bottom:1px solid #eee;margin:0">
  23. <div class="media-left">
  24. <a href="{{ url_for('user.user',user_url=reply.author.username) }}">
  25. <img class="media-object img-circle" src="{{ link_base.avatar(reply.author)}}" alt="avatar" style="width:48px;height:48px">
  26. </a>
  27. </div>
  28. <div class="media-body">
  29. <small class="media-heading" style="color:#999">
  30. <span>{{ link_base.user(reply.author.username)}}</span>
  31. <span>{{ reply.publish | timesince }}</span>
  32. <a name="reply{{ num }}" class="anchor" href="#reply{{ num }}" aria-hidden="true">#{{ num }}</a>
  33. </small>
  34. <div>
  35. {{ reply.content | safe_clean }}
  36. </div>
  37. </div>
  38. <div class="media-right">
  39. {% if reply in current_user.likes and g.user.is_authenticated %}
  40. <a href="javascript:void(0);" style="padding:0" class="like-reply btn btn-sm like-active" data-id="{{ reply.id}}" title="取消赞">
  41. <i class="icon-thumbs-up"></i>
  42. </a>
  43. {% else %}
  44. <a href="javascript:void(0);" style="padding:0" class="like-reply btn btn-sm like-no-active" data-id="{{ reply.id}}" title="赞">
  45. <i class="icon-thumbs-up"></i>
  46. </a>
  47. {% endif %}
  48. </div>
  49. <div class="media-right">
  50. <a href="javascript:void(0);" style="color:#ccc;padding:0" class="reply-author btn btn-sm" data-id="{{ reply.author.username }}" title="回复">
  51. <i class="icon-reply"></i>
  52. </a>
  53. </div>
  54. </div>
  55. {% set num = num + 1 %}
  56. {% endfor %}
  57. {{ p_footer(replies,'topic.topic',dict(uid=topic.uid))}}
  58. {% else %}
  59. <div class="panel-body">
  60. <span class="text-center" style="display:block;width:100%;color:#999">
  61. 暂无回复
  62. </span>
  63. </div>
  64. {% endif %}
  65. </div>
  66. <div class="panel panel-default">
  67. {% if g.user.is_authenticated %}
  68. <div class="panel-heading"> 回帖 </div>
  69. <div class="panel-body">
  70. <form action="{{ url_for('topic.reply',uid=topic.id)}}" method="POST">
  71. {{ form.hidden_tag() }}
  72. {{ form.content(class='form-control')}}
  73. <button class="btn btn-sm btn-primary" type="submit">提交回复</button>
  74. </form>
  75. </div>
  76. {% else %}
  77. <div class="panel-body" style="border:1px dashed #337ab7;margin:5px;">
  78. <span class="text-center" style="display:block;width:100%;color:#999">
  79. <span class="glyphicon glyphicon-lock" aria-hidden="true" style="font-size:16px;"></span>
  80. 你需要<a href="{{ url_for('auth.login') }}">登陆</a>后才能发表回复
  81. </span>
  82. </div>
  83. {% endif %}
  84. </div>