content.html 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. {% import 'base/link.html' as link %}
  2. {% import 'base/user.html' as user %}
  3. <style type="text/css" media="all">
  4. img {
  5. width:120px;
  6. height:auto;
  7. }
  8. blockquote {
  9. font-size:12px;
  10. background:#f8f8f8;
  11. border:1px solid #999;
  12. border-radius:5px;
  13. padding-bottom:0;
  14. }
  15. </style>
  16. <div class="panel panel-default container-fluid" style="padding:0;">
  17. {% if number == 1 %}
  18. <div class="panel-heading">
  19. <div class="row">
  20. <div class="col-md-2">
  21. {{ link.userlink(question.author) }}
  22. {%- if question.author == 'honmaple' -%}
  23. <span style="font-size:12px;color:#999">(网站管理员)</span>
  24. {%- endif %}
  25. </div>
  26. {% if current_user.is_authenticated %}
  27. <div class="col-md-10" style="font-size:12px;">
  28. 发表于 {{ question.time.strftime('%Y-%m-%d %H:%M:%S') }}
  29. <div style="float:right;">
  30. <span> 1# </span>
  31. <span style="font-size:12px;">
  32. {% if question.id | judge('collect') %}
  33. {{ link.collect(question=question,mode='cancel',chname='取消收藏') }}
  34. {% else %}
  35. {{ link.collect(question=question,mode='join',chname='加入收藏') }}
  36. {% endif %}
  37. </span>
  38. </div>
  39. </div>
  40. {% else %}
  41. <div class="col-md-9" style="font-size:12px;">
  42. 发表于 {{ question.time.strftime('%Y-%m-%d %H:%M:%S') }}
  43. </div>
  44. <div class="col-md-1">
  45. 1#
  46. </div>
  47. {% endif %}
  48. </div>
  49. </div>
  50. <div class="panel-body row">
  51. {{ user.infor(question.author) }}
  52. <div class="clearfix visible-xs-block"></div>
  53. <div class="col-md-10">
  54. {% if question.is_markdown %}
  55. {{ question.content | safe_markdown }}
  56. {% else %}
  57. {{ question.content | safe_clean }}
  58. {% endif %}
  59. </div>
  60. </div>
  61. {% endif %}
  62. {% if number == 1 %}
  63. {%- set num = 2 -%}
  64. {% else %}
  65. {%- set num = (number-1)*12+2 -%}
  66. {% endif %}
  67. {% set a = (number-1)*12 %}
  68. {% set b = (number-1)*12+12 %}
  69. {% for reply in question.replies[a:b] %}
  70. <div class="panel-heading">
  71. <div class="row">
  72. <div class="col-md-2">
  73. {{ link.userlink(reply.author) }}
  74. </div>
  75. <div class="col-md-9" style="font-size:12px;">
  76. 发表于 {{ reply.time.strftime('%Y-%m-%d %H:%M:%S') }}
  77. </div>
  78. <div class="col-md-1">
  79. {{ num }}#
  80. </div>
  81. </div>
  82. </div>
  83. <div class="panel-body row" style="padding-bottom:0;">
  84. {{ user.infor(reply.author) }}
  85. <div class="col-md-10">
  86. {{ reply.quote | safe_clean }}
  87. {{ reply.content | safe_clean }}
  88. </div>
  89. </div>
  90. <span style="display:block;text-align:right;width:100%;padding-right:20px;">
  91. <script type="text/javascript" charset="utf-8">
  92. $(document).ready(function(){
  93. $('a#{{ num }}').click(function(){
  94. $.post("{{ url_for('tags.rreply',rid=reply.id) }}",
  95. function(data) {
  96. $("#content").focus();
  97. $('#quote').html(data)
  98. });
  99. });
  100. });
  101. </script>
  102. {% if current_user.is_authenticated %}
  103. <a class="btn btn-sm" id="{{ num }}" title="回复{{ reply.author }} "style="font-size:12px;margin-right:10px;padding:0;">回复</a>
  104. {% if reply.id | judge('love') %}
  105. {{ link.like(reply=reply,mode='unlike',chname='取消赞') }}
  106. {% else %}
  107. {{ link.like(reply=reply,mode='like',chname='赞一下') }}
  108. {% endif %}
  109. {% endif %}
  110. </span>
  111. {%- set num = num + 1 -%}
  112. {% endfor %}
  113. </div>
  114. <div class="panel-body" style="padding:0;margin:0;">
  115. <ul class="pager" style="margin:0;">
  116. {% if number == 1 and pages ==1 %}
  117. <li style="color:#999;">{{ number }}/{{ pages }}</li>
  118. {% elif number == 1 and pages != 1 %}
  119. <li style="color:#999;">{{ number }}/{{ pages }}</li>
  120. <li class="next"><a href="{{ url_for('tags.view',qid=question.id,pid=number + 1) }}">下一页<span aria-hidden="true">&rarr;</span></a></li>
  121. {% else %}
  122. {% if number == pages %}
  123. <li class="previous"><a href="{{ url_for('tags.view',qid=question.id,pid=number-1) }}"><span aria-hidden="true">&larr;</span>上一页</a></li>
  124. <li style="color:#999;">{{ number }}/{{ pages }}</li>
  125. {% else %}
  126. <li class="previous"><a href="{{ url_for('tags.view',qid=question.id,pid=number-1) }}"><span aria-hidden="true">&larr;</span>上一页</a></li>
  127. <li style="color:#999;">{{ number }}/{{ pages }}</li>
  128. <li class="next"><a href="{{ url_for('tags.view',qid=question.id,pid=number + 1) }}">下一页<span aria-hidden="true">&rarr;</span></a></li>
  129. {% endif %}
  130. {% endif %}
  131. </ul>
  132. </div>
  133. {% if current_user.is_authenticated %}
  134. <div class="panel panel-default">
  135. <div class="panel-heading">
  136. 添加一条新回复
  137. </div>
  138. <div class="panel-body row">
  139. <div class="col-sm-2">
  140. <table style="font-size:12px;color:#999">
  141. <tr>
  142. <th colspan="2">回复支持部分html标签</th>
  143. </tr>
  144. {% import 'base/panel.html' as panel -%}
  145. {{ panel.html() }}
  146. </table>
  147. </div>
  148. <div class="col-md-10">
  149. <div class="alert alert-info" id="showerror" style="padding:8px;">
  150. <button type="button" class="close" id="hide">
  151. <span aria-hidden="true">&times;</span>
  152. </button>
  153. <ul>
  154. <li id="error"></li>
  155. </ul>
  156. </div>
  157. <p id="quote"></p>
  158. {{ form.content(class="form-control",rows=6,style="width:100%;") }}
  159. <button type="botton" class="btn btn-sm" id="ajax" style="margin-top:10px;">发表回复</button>
  160. </div>
  161. </div>
  162. </div>
  163. {% endif %}