_content_macro.html 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. {% import 'base/link.html' as link %}
  2. {% macro votes(topic) -%}
  3. <div class="votes">
  4. {% if topic.vote and topic.vote > 0 -%}
  5. {{ vote_a('up',topic.vote) }}
  6. {% else %}
  7. {{ vote_a('up') }}
  8. {%- endif %}
  9. {% if topic.vote and topic.vote < 0 %}
  10. {{ vote_a('down',topic.vote) }}
  11. {% else %}
  12. {{ vote_a('down') }}
  13. {%- endif %}
  14. </div>
  15. {%- endmacro %}
  16. {% macro vote_a(vo,count=None) -%}
  17. {% if count -%}
  18. <a id="topic-{{ vo }}-vote" class="vote" href="javascript:void(0)" style="text-decoration:none;">
  19. <i class="icon-chevron-{{ vo }}">{{ count }}</i>
  20. </a>
  21. {% else %}
  22. <a id="topic-{{ vo }}-vote" class="vote" href="javascript:void(0)" style="text-decoration:none;">
  23. <i class="icon-chevron-{{ vo }}"></i>
  24. </a>
  25. {%- endif %}
  26. {%- endmacro %}
  27. {% macro title(topic) -%}
  28. {% set author = topic.author %}
  29. <div class="panel-heading media">
  30. <div class="media-body">
  31. <h3 class="media-heading" style="font-size:20px;"><b>{{ topic.title }}</b></h3>
  32. <small style="color:#999">
  33. {{ votes(topic) }}
  34. {% for tag in topic.tags %}
  35. {{ link.tag(tag) }}
  36. {% endfor %}
  37. <span style="margin-left:10px;">
  38. {% set last_reply = topic.replies.first() %}
  39. {{ topic.author.username }}
  40. {{ _('published at %(time)s',time = topic.created_at | timesince ) }}
  41. {% if last_reply %}
  42. · {{ _('The last reply published by %(author)s at %(time)s',author=link.user(last_reply.author.username),time=last_reply.created_at | timesince)}}
  43. {% endif %}
  44. </span>
  45. </small>
  46. </div>
  47. <div class="media-right">
  48. <a href="{{ url_for('user.user',username=topic.author.username)}}">
  49. <img class="media-object img-circle" src="{{ url_for('avatar',text=author.username)}}" style="width:56px;height:56px">
  50. </a>
  51. </div>
  52. </div>
  53. {%- endmacro %}
  54. {% macro body(topic) -%}
  55. <div class="panel-body topic-content">
  56. {% if topic.is_markdown %}
  57. {{ topic.content | markdown }}
  58. {% else %}
  59. {{ topic.content | safe_clean }}
  60. {% endif %}
  61. </div>
  62. {%- endmacro %}