karmas.html 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. {% extends "cranefly/layout.html" %}
  2. {% import "cranefly/macros.html" as macros with context %}
  3. {% block title %}{{ macros.page_title(title=(_("Post #%(post)s Votes") % {'post': post.pk}),parent=thread.name) }}{% endblock %}
  4. {% block breadcrumb %}{{ super() }} <span class="divider"><i class="icon-chevron-right"></i></span></li>
  5. {{ macros.parents_list(parents) }}
  6. <li><a href="{{ url('thread', thread=thread.pk, slug=thread.slug) }}">{{ thread.name }}</a> <span class="divider"><i class="icon-chevron-right"></i></span></li>
  7. <li class="active">{% trans post=post.pk %}Post #{{ post }} Votes{% endtrans %}
  8. {%- endblock %}
  9. {% block container %}
  10. <div class="page-header header-primary">
  11. <div class="container">
  12. {{ messages_list(messages) }}
  13. <ul class="breadcrumb">
  14. {{ self.breadcrumb() }}</li>
  15. </ul>
  16. <h1>{% trans post=post.pk %}Post #{{ post }} Votes{% endtrans %} <small>{{ thread.name|short_string(42) }}</small></h1>
  17. <ul class="unstyled header-stats">
  18. <li><i class="icon-time"></i> <a href="{{ url('thread_find', thread=thread.pk, slug=thread.slug, post=post.pk) }}">{{ post.date|reltimesince }}</a></li>
  19. <li><i class="icon-user"></i> {% if post.user %}<a href="{{ url('user', user=post.user.pk, username=post.user.username_slug) }}">{{ post.user.username }}</a>{% else %}{{ post.user_name }}{% endif %}</li>
  20. <li><i class="icon-thumbs-up"></i> {{ post.upvotes }}</li>
  21. <li><i class="icon-thumbs-down"></i> {{ post.downvotes }}</li>
  22. </ul>
  23. </div>
  24. </div>
  25. <div class="container container-primary">
  26. <div class="post-votes-list">
  27. <div class="post-likes">
  28. {% if upvotes %}
  29. <h2 class="text-success"><i class="icon-thumbs-up-alt"></i> {% trans count=upvotes|length, votes=upvotes|length|intcomma -%}
  30. One like
  31. {%- pluralize -%}
  32. {{ votes }} likes
  33. {%- endtrans %}</h2>
  34. <table class="table table-striped">
  35. <tbody>
  36. {% for row in upvotes|batch(4, '') %}
  37. <tr>
  38. {% for vote in row %}
  39. <td class="span3">
  40. {% if vote %}
  41. {{ vote_details(vote) }}
  42. {% else %}
  43. &nbsp;
  44. {% endif %}
  45. </td>
  46. {% endfor %}
  47. </tr>
  48. {% endfor %}
  49. </tbody>
  50. </table>
  51. {% else %}
  52. <p class="lead"><i class="icon-meh"></i> {% trans %}Nobody liked this post.{% endtrans %}</p>
  53. {% endif %}
  54. </div>
  55. <hr>
  56. <div class="post-dislikes">
  57. {% if downvotes %}
  58. <h2 class="text-error"><i class="icon-thumbs-down-alt"></i> {% trans count=downvotes|length, votes=downvotes|length|intcomma -%}
  59. One dislike
  60. {%- pluralize -%}
  61. {{ votes }} dislikes
  62. {%- endtrans %}</h2>
  63. <table class="table table-striped">
  64. <tbody>
  65. {% for row in downvotes|batch(4, '') %}
  66. <tr>
  67. {% for vote in row %}
  68. <td class="span3">
  69. {% if vote %}
  70. {{ vote_details(vote) }}
  71. {% else %}
  72. &nbsp;
  73. {% endif %}
  74. </td>
  75. {% endfor %}
  76. </tr>
  77. {% endfor %}
  78. </tbody>
  79. </table>
  80. {% else %}
  81. <p class="lead"><i class="icon-smile"></i> {% trans %}Nobody disliked this post.{% endtrans %}</p>
  82. {% endif %}
  83. </div>
  84. </div>
  85. </div>
  86. {% endblock %}
  87. {% block javascripts %}{{ super() }}
  88. <script type="text/javascript">
  89. $(function() {
  90. {% for vote in (upvotes|list + downvotes|list) %}
  91. $('.vote-{{ vote.id }}').popover({
  92. 'placement': 'top',
  93. 'trigger': 'hover',
  94. 'html': true,
  95. {% if acl.users.can_see_users_trails() %}
  96. 'title': '<strong>{{ vote.date|reldate }}</strong>',
  97. 'content': '{% trans ip=vote.ip %}From {{ ip }}{% endtrans %}'
  98. {% else %}
  99. 'content': '<strong>{{ vote.data|reldate }}</strong>'
  100. {% endif %}
  101. });
  102. {% endfor %}
  103. });
  104. </script>
  105. {% endblock %}
  106. {% macro vote_details(vote) %}
  107. {% if vote.user_id %}
  108. <a href="{{ url('user', user=vote.user_id, username=vote.user_slug) }}" class="vote-user vote-{{ vote.pk }}">{{ vote.user_name }}</a>
  109. {% else %}
  110. <span class="vote-user vote-{{ vote.pk }}">{{ vote.user_name }}</span>
  111. {% endif %}
  112. {% endmacro %}