replies.html 3.9 KB

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