replies.html 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <style>
  2. .like-active {
  3. color:#a40004;
  4. }
  5. .like-no-active {
  6. color:#ccc;
  7. }
  8. .reply-order a{
  9. padding: 1px 2px;
  10. color: #778087;
  11. text-decoration: none;
  12. font-size:13px;
  13. }
  14. .reply-count {
  15. font-size:12px;
  16. color:#999;
  17. }
  18. </style>
  19. <div class="panel panel-default" id="replies-content">
  20. <div class="panel-heading">
  21. {{ _('Received %(total)s replies',total=replies.total) }}
  22. <ul class="pull-right list-inline reply-order">
  23. <li><a href="{{ url_for('topic.topic',topicId=topic.uid,orderby='time')}}"> <i class="icon icon-time"></i>时间</a></li>
  24. <li><a href="{{ url_for('topic.topic',topicId=topic.uid,orderby='like')}}"> <i class="icon icon-thumbs-up"></i>点赞数</a></li>
  25. </ul>
  26. </div>
  27. {% if replies.items %}
  28. {% set num = 1 %}
  29. {% for reply in replies.items %}
  30. <div class="panel-body media" id="reply-{{ reply.id }}" style="border-bottom:1px solid #eee;margin:0">
  31. <div class="media-left">
  32. <a href="{{ url_for('user.user',user_url=reply.author.username) }}">
  33. <img class="media-object img-circle" src="{{ link_base.avatar(reply.author)}}" alt="avatar" style="width:48px;height:48px">
  34. </a>
  35. </div>
  36. <div class="media-body">
  37. <small class="media-heading" style="color:#999">
  38. <span>{{ link_base.user(reply.author.username)}}</span>
  39. <span>{{ reply.publish | timesince }}</span>
  40. <a name="reply{{ reply.id }}" class="anchor" href="#reply{{ num }}" aria-hidden="true">#{{ num }}</a>
  41. </small>
  42. <div>
  43. {{ reply.content | safe_clean }}
  44. </div>
  45. </div>
  46. <div class="media-right">
  47. {% if reply in current_user.likes and g.user.is_authenticated %}
  48. <a href="javascript:void(0);" style="padding:0" class="like-reply btn btn-sm like-active" data-id="{{ reply.id}}" title="取消赞">
  49. <i class="icon-thumbs-up"></i>
  50. <span class="reply-count">{{ reply.likers | length }}</span>
  51. </a>
  52. {% else %}
  53. <a href="javascript:void(0);" style="padding:0" class="like-reply btn btn-sm like-no-active" data-id="{{ reply.id}}" title="赞">
  54. <i class="icon-thumbs-up"></i>
  55. <span class="reply-count">{{ reply.likers | length }}</span>
  56. </a>
  57. {% endif %}
  58. </div>
  59. <div class="media-right">
  60. <a href="javascript:void(0);" style="color:#ccc;padding:0" class="reply-author btn btn-sm" data-id="{{ reply.author.username }}" title="回复">
  61. <i class="icon-reply"></i>
  62. </a>
  63. </div>
  64. </div>
  65. {% set num = num + 1 %}
  66. {% endfor %}
  67. {{ p_footer(replies,'topic.topic',dict(topicId=topic.uid))}}
  68. {% else %}
  69. <div class="panel-body">
  70. <span class="text-center" style="display:block;width:100%;color:#999">
  71. 暂无回复
  72. </span>
  73. </div>
  74. {% endif %}
  75. </div>
  76. <div class="panel panel-default">
  77. {% if g.user.is_authenticated %}
  78. <div class="panel-heading"> {{ _('Reply this topic') }} </div>
  79. <div class="panel-body">
  80. <form action="{{ url_for('topic.reply',topicId=topic.id)}}" method="POST">
  81. {{ form.hidden_tag() }}
  82. {{ form.content(class='form-control')}}
  83. <button class="btn btn-sm btn-primary" type="submit">{{ _('Post reply') }}</button>
  84. </form>
  85. </div>
  86. {% else %}
  87. <div class="panel-body" style="border:1px dashed #337ab7;margin:5px;">
  88. <span class="text-center" style="display:block;width:100%;color:#999">
  89. <span class="glyphicon glyphicon-lock" aria-hidden="true" style="font-size:16px;"></span>
  90. {{_('You need')}} <a href="{{ url_for('auth.login') }}">{{ _('Login')}}</a> {{_('before you can reply.')}}
  91. </span>
  92. </div>
  93. {% endif %}
  94. </div>