karmas.html 4.4 KB

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