content.html 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. {% extends 'base/base.html' %}
  2. {% block script -%}
  3. {{ super() }}
  4. <script type="text/javascript">
  5. var voteData = {
  6. 'vote_up': "{{ url_for('topic.vote_up',topicId=topic.uid)}}",
  7. 'vote_down': "{{ url_for('topic.vote_down',topicId=topic.uid)}}"
  8. };
  9. DoVote(voteData);
  10. </script>
  11. {%- endblock script %}
  12. {% block content %}
  13. {% set board = topic.board %}
  14. <ol class="breadcrumb" style="margin:0">
  15. <li><a href="{{ url_for('forums.forums') }}"><span class="glyphicon glyphicon-home" aria-hidden="true"></span>{{ _('Index') }}</a></li>
  16. <li><a href="{{ url_for('board.board',parent_b=board.parent_board) }}">{{ board.parent_board }}</a></li>
  17. <li><a href="{{ url_for('board.board',parent_b=board.parent_board,child_b=board.board)}}">{{ board.board }}</a></li>
  18. <li class="active">{{ topic.title }}</li>
  19. </ol>
  20. {% from 'base/paginate.html' import footer as p_footer %}
  21. <div class="row">
  22. <div class="col-md-9">
  23. <div class="panel panel-default">
  24. <div class="panel-heading media ">
  25. <div class="media-body">
  26. <h3 class="media-heading" style="font-size:20px;"><b>{{ topic.title}}</b></h3>
  27. <small style="color:#999">
  28. {{ votes(topic) }}
  29. {% for tag in topic.tags %}
  30. {{ link_base.tag(tag) }}
  31. {% endfor %}
  32. <span style="margin-left:10px;">
  33. {% set last_reply = topic.replies.first() %}
  34. {{ link_base.user(topic.author.username )}}
  35. {{ _('published at %(time)s',time = topic.publish | timesince ) }}
  36. {% if last_reply %}
  37. · {{ _('The last reply published by %(author)s at %(time)s',author=link_base.user(last_reply.author.username),time=last_reply.publish | timesince)}}
  38. {% endif %}
  39. </span>
  40. </small>
  41. </div>
  42. <div class="media-right">
  43. <a href="{{ url_for('user.user',user_url=topic.author.username)}}">
  44. <img class="media-object img-circle" src="{{ link_base.avatar(topic.author) }}" alt="avatar" style="width:64px;height:64px">
  45. </a>
  46. </div>
  47. </div>
  48. <div class="panel-body topic-content">
  49. {% if topic.is_markdown %}
  50. {{ topic.content | markdown }}
  51. {% else %}
  52. {{ topic.content | safe_clean }}
  53. {% endif %}
  54. </div>
  55. </div>
  56. {% include 'topic/replies.html' %}
  57. </div>
  58. <div class="col-md-3" style="padding-left:0">
  59. {% set ask_url = url_for('topic.ask',boardId=topic.board.id) %}
  60. {% include 'topic/panel.html' %}
  61. {{ panel_base.board() }}
  62. </div>
  63. </div>
  64. {% endblock %}
  65. {% macro votes(topic) -%}
  66. <div class="votes">
  67. {% if topic.vote and topic.vote > 0 -%}
  68. {{ vote_a('up',topic.vote) }}
  69. {% else %}
  70. {{ vote_a('up') }}
  71. {%- endif %}
  72. {% if topic.vote and topic.vote < 0 %}
  73. {{ vote_a('down',topic.vote) }}
  74. {% else %}
  75. {{ vote_a('down') }}
  76. {%- endif %}
  77. </div>
  78. {%- endmacro %}
  79. {% macro vote_a(vo,count=None) -%}
  80. {% if count -%}
  81. <a id="topic-{{ vo }}-vote" class="vote" href="javascript:void(0)" style="text-decoration:none;">
  82. <i class="icon-chevron-{{ vo }}">{{ count }}</i>
  83. </a>
  84. {% else %}
  85. <a id="topic-{{ vo }}-vote" class="vote" href="javascript:void(0)" style="text-decoration:none;">
  86. <i class="icon-chevron-{{ vo }}"></i>
  87. </a>
  88. {%- endif %}
  89. {%- endmacro %}