content.html 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. {% extends 'base/base.html' %}
  2. {% block style %}
  3. {{ super() }}
  4. <style>
  5. .vote {
  6. font-size: 10px;
  7. line-height: 1;
  8. padding: 2px 8px;
  9. border: 1px solid #C4C4C4;
  10. border-radius: 3px;
  11. color: #778;
  12. display: inline-block;
  13. vertical-align: baseline;
  14. text-align: center;
  15. background-color: #fff;
  16. text-decoration: none;
  17. }
  18. </style>
  19. {% endblock %}
  20. {% block script -%}
  21. {{ super() }}
  22. <script type="text/javascript">
  23. var voteData = {
  24. 'vote_up': "{{ url_for('topic.vote_up',topicId=topic.uid)}}",
  25. 'vote_down': "{{ url_for('topic.vote_down',topicId=topic.uid)}}"
  26. };
  27. DoVote(voteData);
  28. </script>
  29. {%- endblock script %}
  30. {% block content %}
  31. {% set board = topic.board %}
  32. <ol class="breadcrumb" style="margin:0">
  33. <li><a href="{{ url_for('forums.forums') }}"><span class="glyphicon glyphicon-home" aria-hidden="true"></span>社区首页</a></li>
  34. <li><a href="{{ url_for('board.board',parent_b=board.parent_board) }}">{{ board.parent_board }}</a></li>
  35. <li><a href="{{ url_for('board.board',parent_b=board.parent_board,child_b=board.board)}}">{{ board.board }}</a></li>
  36. <li class="active">{{ topic.title }}</li>
  37. </ol>
  38. {% set last_reply = topic.replies.first() %}
  39. {% from 'base/paginate.html' import footer as p_footer %}
  40. <div class="row">
  41. <div class="col-md-9">
  42. <div class="panel panel-default">
  43. <div class="panel-heading media ">
  44. <div class="media-body">
  45. <h3 class="media-heading">{{ topic.title}}</h3>
  46. <small style="color:#999">
  47. <div class="votes">
  48. {% if topic.vote and topic.vote > 0 -%}
  49. <a id="topic-up-vote" class="vote" href="javascript:void(0)" style="text-decoration:none;">
  50. <i class="icon-chevron-up">{{ topic.vote}}</i>
  51. </a>
  52. {% else %}
  53. <a id="topic-up-vote" class="vote" href="javascript:void(0)" style="text-decoration:none;">
  54. <i class="icon-chevron-up"></i>
  55. </a>
  56. {%- endif %}
  57. {% if topic.vote and topic.vote < 0 %}
  58. <a id="topic-down-vote" class="vote" href="javascript:void(0)" style="text-decoration:none;">
  59. <i class="icon-chevron-down">{{ topic.vote}}</i>
  60. </a>
  61. {% else %}
  62. <a id="topic-down-vote" class="vote" href="javascript:void(0)" style="text-decoration:none;">
  63. <i class="icon-chevron-down"></i>
  64. </a>
  65. {%- endif %}
  66. </div>
  67. {% for tag in topic.tags %}
  68. {{ link_base.tag(tag) }}
  69. {% endfor %}
  70. <br/>
  71. {{ link_base.user(topic.author.username )}}
  72. 于 <abbr class="timeago" title="{{ topic.publish}}">{{ topic.publish | timesince }}</abbr>发布
  73. {% if last_reply %}
  74. 最后由{{ link_base.user(last_reply.author.username )}}于
  75. <abbr class="timeago" title="{{ topic.publish}}">{{ last_reply.publish | timesince }}</abbr>回复
  76. {% endif %}
  77. </small>
  78. </div>
  79. <div class="media-right">
  80. <a href="{{ url_for('user.user',user_url=topic.author.username)}}">
  81. <img class="media-object img-circle" src="{{ link_base.avatar(topic.author) }}" alt="avatar" style="width:64px;height:64px">
  82. </a>
  83. </div>
  84. </div>
  85. <div class="panel-body topic-content">
  86. {% if topic.is_markdown %}
  87. {{ topic.content | markdown }}
  88. {% else %}
  89. {{ topic.content | safe_clean }}
  90. {% endif %}
  91. </div>
  92. </div>
  93. {% include 'topic/replies.html' %}
  94. </div>
  95. <div class="col-md-3" style="padding-left:0">
  96. {% set ask_url = url_for('topic.ask',boardId=topic.board.id) %}
  97. {% include 'topic/panel.html' %}
  98. {{ panel_base.board() }}
  99. </div>
  100. </div>
  101. {% endblock %}