content.html 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. {% set last_reply = topic.replies.first() %}
  21. {% from 'base/paginate.html' import footer as p_footer %}
  22. <div class="row">
  23. <div class="col-md-9">
  24. <div class="panel panel-default">
  25. <div class="panel-heading media ">
  26. <div class="media-body">
  27. <h3 class="media-heading">{{ topic.title}}</h3>
  28. <small style="color:#999">
  29. {{ votes(topic) }}
  30. {% for tag in topic.tags %}
  31. {{ link_base.tag(tag) }}
  32. {% endfor %}
  33. <br/>
  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. </small>
  40. </div>
  41. <div class="media-right">
  42. <a href="{{ url_for('user.user',user_url=topic.author.username)}}">
  43. <img class="media-object img-circle" src="{{ link_base.avatar(topic.author) }}" alt="avatar" style="width:64px;height:64px">
  44. </a>
  45. </div>
  46. </div>
  47. <div class="panel-body topic-content">
  48. {% if topic.is_markdown %}
  49. {{ topic.content | markdown }}
  50. {% else %}
  51. {{ topic.content | safe_clean }}
  52. {% endif %}
  53. </div>
  54. </div>
  55. {% include 'topic/replies.html' %}
  56. </div>
  57. <div class="col-md-3" style="padding-left:0">
  58. {% set ask_url = url_for('topic.ask',boardId=topic.board.id) %}
  59. {% include 'topic/panel.html' %}
  60. {{ panel_base.board() }}
  61. </div>
  62. </div>
  63. {% endblock %}
  64. {% macro votes(topic) -%}
  65. <div class="votes">
  66. {% if topic.vote and topic.vote > 0 -%}
  67. {{ vote_a('up',topic.vote) }}
  68. {% else %}
  69. {{ vote_a('up') }}
  70. {%- endif %}
  71. {% if topic.vote and topic.vote < 0 %}
  72. {{ vote_a('down',topic.vote) }}
  73. {% else %}
  74. {{ vote_a('down') }}
  75. {%- endif %}
  76. </div>
  77. {%- endmacro %}
  78. {% macro vote_a(vo,count=None) -%}
  79. {% if count -%}
  80. <a id="topic-{{ vo }}-vote" class="vote" href="javascript:void(0)" style="text-decoration:none;">
  81. <i class="icon-chevron-{{ vo }}">{{ count }}</i>
  82. </a>
  83. {% else %}
  84. <a id="topic-{{ vo }}-vote" class="vote" href="javascript:void(0)" style="text-decoration:none;">
  85. <i class="icon-chevron-{{ vo }}"></i>
  86. </a>
  87. {%- endif %}
  88. {%- endmacro %}