content.html 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. {% extends 'base/base.html' %}
  2. {% block content %}
  3. {% set board = topic.board %}
  4. {{ breadcrumb(hrefs={board.parent_board:url_for('board.board',parent_b=board.parent_board),
  5. board.board:url_for('board.board',parent_b=board.parent_board,child_b=board.board)},active=topic.title)}}
  6. {% set last_reply = topic.replies.first() %}
  7. <style>
  8. .vote {
  9. font-size: 10px;
  10. line-height: 1;
  11. padding: 2px 8px;
  12. border: 1px solid #C4C4C4;
  13. border-radius: 3px;
  14. color: #778;
  15. display: inline-block;
  16. vertical-align: baseline;
  17. text-align: center;
  18. background-color: #fff;
  19. text-decoration: none;
  20. }
  21. </style>
  22. <script type="text/javascript">
  23. function upVoteTopic(topicId) {
  24. if (g.csrftoken) {
  25. var data = JSON.stringify({
  26. });
  27. $.ajax ({
  28. type : "POST",
  29. url : "{{ url_for('topic.vote_up',topicId=topic.uid)}}",
  30. data:data,
  31. contentType: 'application/json;charset=UTF-8',
  32. success: function(result) {
  33. if (result.judge)
  34. {
  35. $('.votes').html(result.html);
  36. } else
  37. {
  38. window.location.href = result.url;
  39. }
  40. }});
  41. }
  42. }
  43. function downVoteTopic(topicId) {
  44. if (g.csrftoken) {
  45. var data = JSON.stringify({
  46. });
  47. $.ajax ({
  48. type : "POST",
  49. url : "{{ url_for('topic.vote_down',topicId=topic.uid)}}",
  50. data:data,
  51. contentType: 'application/json;charset=UTF-8',
  52. success: function(result) {
  53. if (result.judge)
  54. {
  55. $('.votes').html(result.html);
  56. } else
  57. {
  58. window.location.href = result.url;
  59. }
  60. }});
  61. }
  62. }
  63. </script>
  64. {% from 'base/paginate.html' import footer as p_footer %}
  65. <div class="row">
  66. <div class="col-md-9">
  67. <div class="panel panel-default">
  68. <div class="panel-heading media ">
  69. <div class="media-body">
  70. <h3 class="media-heading">{{ topic.title}}</h3>
  71. <small style="color:#999">
  72. <div class="votes">
  73. {% if topic.vote and topic.vote > 0 -%}
  74. <a class="vote" href="javascript:void(0)" onclick="upVoteTopic({{ topic.uid }});" style="text-decoration:none;">
  75. <i class="icon-chevron-up">{{ topic.vote}}</i>
  76. </a>
  77. {% else %}
  78. <a class="vote" href="javascript:void(0)" onclick="upVoteTopic({{ topic.uid }});" style="text-decoration:none;">
  79. <i class="icon-chevron-up"></i>
  80. </a>
  81. {%- endif %}
  82. {% if topic.vote and topic.vote < 0 %}
  83. <a class="vote" href="javascript:void(0)" onclick="downVoteTopic({{ topic.uid }});" style="text-decoration:none;">
  84. <i class="icon-chevron-down">{{ topic.vote}}</i>
  85. </a>
  86. {% else %}
  87. <a class="vote" href="javascript:void(0)" onclick="downVoteTopic({{ topic.uid }});" style="text-decoration:none;">
  88. <i class="icon-chevron-down"></i>
  89. </a>
  90. {%- endif %}
  91. </div>
  92. {% for tag in topic.tags %}
  93. {{ link_base.tag(tag) }}
  94. {% endfor %}
  95. <br/>
  96. {{ link_base.user(topic.author.username )}}
  97. 于 <abbr class="timeago" title="{{ topic.publish}}">{{ topic.publish | timesince }}</abbr>发布
  98. {% if last_reply %}
  99. 最后由{{ link_base.user(last_reply.author.username )}}于
  100. <abbr class="timeago" title="{{ topic.publish}}">{{ last_reply.publish | timesince }}</abbr>回复
  101. {% endif %}
  102. </small>
  103. </div>
  104. <div class="media-right">
  105. <a href="{{ url_for('user.user',user_url=topic.author.username)}}">
  106. <img class="media-object img-circle" src="{{ link_base.avatar(topic.author.infor) }}" alt="avatar" style="width:64px;height:64px">
  107. </a>
  108. </div>
  109. </div>
  110. <div class="panel-body topic-content">
  111. {% if topic.is_markdown %}
  112. {{ topic.content | markdown }}
  113. {% else %}
  114. {{ topic.content | safe_clean }}
  115. {% endif %}
  116. </div>
  117. </div>
  118. {% include 'topic/replies.html' %}
  119. </div>
  120. <div class="col-md-3" style="padding-left:0">
  121. {% set ask_url = url_for('topic.ask',boardId=topic.board.id) %}
  122. {% include 'topic/panel.html' %}
  123. </div>
  124. </div>
  125. {% endblock %}