karmas.html 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. {% extends "cranefly/layout.html" %}
  2. {% load i18n %}
  3. {% load url from future %}
  4. {% import "cranefly/macros.html" as macros with context %}
  5. {% block title %}{{ macros.page_title(title=(_("Post #%(post)s Votes") % {'post': post.pk}),parent=thread.name) }}{% endblock %}
  6. {% block breadcrumb %}{{ super() }} <span class="divider">/</span></li>
  7. {% for parent in parents %}
  8. <li><a href="{{ parent.type|url(forum=parent.pk, slug=parent.slug) }}">{{ parent.name }}</a> <span class="divider">/</span></li>
  9. {% endfor %}
  10. <li><a href="{% url 'thread' thread=thread.pk, slug=thread.slug %}">{{ thread.name }}</a> <span class="divider">/</span></li>
  11. <li class="active">{% trans post=post.pk %}Post #{{ post }} Votes{% endtrans %}
  12. {%- endblock %}
  13. {% block content %}
  14. <div class="page-header">
  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 thread-info">
  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 - post.downvotes }}</li>
  23. </ul>
  24. </div>
  25. <h2>{% trans %}Upvotes{% endtrans %} <small>{% trans count=upvotes|length, votes=upvotes|length|intcomma -%}
  26. One upvote
  27. {%- pluralize -%}
  28. {{ votes }} upvotes
  29. {%- endtrans %}</small></h2>
  30. {% if upvotes %}
  31. <table class="table table-striped table-users list-tiny">
  32. <thead>
  33. <tr>
  34. <th colspan="4">{% trans %}Votes List{% endtrans %}</th>
  35. </tr>
  36. </thead>
  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) }}
  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 has upvoted this post.{% endtrans %}</p>
  55. {% endif %}
  56. <hr>
  57. <h2>{% trans %}Downvotes{% endtrans %} <small>{% trans count=downvotes|length, votes=downvotes|length|intcomma -%}
  58. One downvote
  59. {%- pluralize -%}
  60. {{ votes }} downvotes
  61. {%- endtrans %}</small></h2>
  62. {% if downvotes %}
  63. <table class="table table-striped table-users list-tiny">
  64. <thead>
  65. <tr>
  66. <th colspan="4">{% trans %}Votes List{% endtrans %}</th>
  67. </tr>
  68. </thead>
  69. <tbody>
  70. {% for row in downvotes|batch(4, '') %}
  71. <tr>
  72. {% for vote in row %}
  73. <td class="span3">
  74. {% if vote %}
  75. {{ vote_details(vote) }}
  76. {% else %}
  77. &nbsp;
  78. {% endif %}
  79. </td>
  80. {% endfor %}
  81. </tr>
  82. {% endfor %}
  83. </tbody>
  84. </table>
  85. {% else %}
  86. <p class="lead">{% trans %}Nobody has downvoted this post.{% endtrans %}</p>
  87. {% endif %}
  88. {% endblock %}
  89. {% macro vote_details(vote) %}
  90. <div>{% if vote.user_id %}<a href="{% url 'user' user=vote.user_id, username=vote.user_slug %}">{{ vote.user_name }}</a>{% else %}<em><strong>{{ vote.user_name }}</strong></em>{% endif %}</div>
  91. <div class="muted{% if acl.users.can_see_users_trails() %} tooltip-top{% endif %}"{% if acl.users.can_see_users_trails() %} title="{{ vote.agent }}"{% endif %}>{{ vote.date|reldate }}{% if acl.users.can_see_users_trails() %}, {{ vote.ip }}{% endif %}</div>
  92. {% endmacro %}