warnings.html 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. {% extends "cranefly/profiles/profile.html" %}
  2. {% import "cranefly/macros.html" as macros with context %}
  3. {% block title %}{{ macros.page_title(_('Warnings'), profile.username) }}{% endblock %}
  4. {% block tab %}
  5. {% if warning_level %}
  6. <div class="warning-level warning-active">
  7. <h3><i class="icon-warning-sign"></i> {{ warning_level.name }}</h3>
  8. {% if warning_level.description %}
  9. <p class="lead">{{ warning_level.description }}</p>
  10. {% endif %}
  11. {% if profile.warning_level_update_on %}
  12. <p class="warning-expiration">{% trans expires=format_warning_expiration(profile.warning_level_update_on|reldate|lower) %}This warning level will expire {{ expires }}.{% endtrans %}</p>
  13. {% else %}
  14. <p class="warning-expiration">{% trans %}This warning level will not expire and will have to be decreased manually by forum team member.{% endtrans %}</p>
  15. {% endif %}
  16. </div>
  17. {% else %}
  18. <div class="warning-level warning-clean">
  19. {% if user.is_authenticated() and user.pk == profile.pk %}
  20. <p class="lead"><i class="icon-ok"></i> {% trans username=profile.username %}{{ username }}, your account has no warning level set. Good job!{% endtrans %}</p>
  21. {% else %}
  22. <p class="lead"><i class="icon-ok"></i> {% trans username=profile.username %}{{ username }}'s account has no warning level set.{% endtrans %}</p>
  23. {% endif %}
  24. </div>
  25. {% endif %}
  26. <h2>{% if items_total -%}
  27. {%- trans count=items_total, total=items_total|intcomma, username=profile.username -%}
  28. {{ username }} received one warning
  29. {%- pluralize -%}
  30. {{ username }} received {{ total }} warnings
  31. {%- endtrans -%}
  32. {%- else -%}
  33. {% trans username=profile.username %}{{ username }} received no warnings{% endtrans %}
  34. {%- endif %}</h2>
  35. {% if items_total %}
  36. <div class="content-list user-warnings">
  37. {% for item in items %}
  38. <div class="media">
  39. <div class="pull-left">
  40. <div class="warning-icon ">
  41. {% if item.canceled %}
  42. <i class="icon-ban-circle warning-canceled tooltip-top" title="{% trans %}This warning has been canceled.{% endtrans %}"></i>
  43. {% elif warnings_tracker.is_warning_expired(item) %}
  44. <i class="icon-warning-sign warning-expired tooltip-top" title="{% trans %}This warning has expired.{% endtrans %}"></i>
  45. {% else %}
  46. <i class="icon-warning-sign warning-active tooltip-top" title="{% trans %}This warning is in effect.{% endtrans %}"></i>
  47. {% endif %}
  48. </div>
  49. </div>
  50. <div class="media-body">
  51. <div class="warning-reason">
  52. {% if item.reason %}
  53. {{ item.reason_preparsed|safe }}
  54. {% else %}
  55. <em>{% trans %}No warning reason was provided by warning giver.{% endtrans %}</em>
  56. {% endif %}
  57. </div>
  58. <div class="media-footer">
  59. {% if acl.warnings.can_cancel_warning(user, profile, item) and not warnings_tracker.is_warning_expired(item) %}
  60. <form action="{{ url('user_warnings_cancel', user=profile.pk, username=profile.username_slug, warning=item.pk) }}" class="confirm-cancel" method="post">
  61. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  62. <button type="submit" class="btn btn-mini"><i class="icon-ban-circle"></i> {% trans %}Cancel{% endtrans %}</button>
  63. </form>
  64. {% endif %}
  65. {% if acl.warnings.can_delete_warnings() %}
  66. <form action="{{ url('user_warnings_delete', user=profile.pk, username=profile.username_slug, warning=item.pk) }}" class="confirm-delete" method="post">
  67. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  68. <button type="submit" class="btn btn-mini"><i class="icon-remove"></i> {% trans %}Delete{% endtrans %}</button>
  69. </form>
  70. {% endif %}
  71. <p>
  72. {% if acl.users.can_see_users_trails() %}
  73. {% trans user=warning_giver(item), date=item.given_on|reltimesince|low, ip=item.giver_ip %}Given by {{ user }} {{ date }} from ip {{ ip }}.{% endtrans %}
  74. {% else %}
  75. {% trans user=warning_giver(item), date=item.given_on|reltimesince|low %}Given by {{ user }} {{ date }}.{% endtrans %}
  76. {% endif %}
  77. {% if item.canceled %}
  78. {% if acl.users.can_see_users_trails() %}
  79. {% trans user=warning_canceler(item), date=item.canceled_on|reltimesince|low, ip=item.canceler_ip %}Canceled by {{ user }} {{ date }} from ip {{ ip }}.{% endtrans %}
  80. {% else %}
  81. {% trans user=warning_canceler(item), date=item.canceled_on|reltimesince|low %}Canceled by {{ user }} {{ date }}.{% endtrans %}
  82. {% endif %}
  83. {% endif %}
  84. </p>
  85. </div>
  86. </div>
  87. </div>
  88. <hr>
  89. {% endfor %}
  90. {{ pager() }}
  91. </div>
  92. {% endif %}
  93. {% endblock %}
  94. {% block javascripts -%}{{ super() }}
  95. <script type="text/javascript">
  96. $(function() {
  97. $('.confirm-cancel').submit(function() {
  98. var decision = confirm("{% trans %}Are you sure you want to cancel this warning?{% endtrans %}");
  99. return decision;
  100. });
  101. $('.confirm-delete').submit(function() {
  102. var decision = confirm("{% trans %}Are you sure you want to delete this warning?{% endtrans %}");
  103. return decision;
  104. });
  105. });
  106. </script>
  107. {%- endblock %}
  108. {% macro format_warning_expiration(expires) %}
  109. <strong>{{ expires }}</strong>
  110. {% endmacro %}
  111. {% macro warning_giver(item) -%}
  112. {% if item.giver_id %}
  113. <a href="{{ url('user', user=item.giver_id, username=item.giver_slug) }}">{{ item.giver_username }}</a>
  114. {% else %}
  115. <strong>{{ item.giver_username }}</strong>
  116. {% endif %}
  117. {%- endmacro %}
  118. {% macro warning_canceler(item) -%}
  119. {% if item.canceler_id %}
  120. <a href="{{ url('user', user=item.canceler_id, username=item.canceler_slug) }}">{{ item.canceler_username }}</a>
  121. {% else %}
  122. <strong>{{ item.canceler_username }}</strong>
  123. {% endif %}
  124. {%- endmacro %}
  125. {% macro pager() -%}
  126. {% if pagination['total'] > 1 %}
  127. <div class="pagination">
  128. <ul>
  129. <li class="count">{{ macros.pager_label(pagination) }}</li>
  130. {%- if pagination['prev'] > 1 %}<li><a href="{{ url('user_warnings', user=profile.id, username=profile.username_slug) }}" class="tooltip-top" title="{% trans %}Lastest Warnings{% endtrans %}"><i class="icon-chevron-left"></i> {% trans %}Latest{% endtrans %}</a></li>{% endif -%}
  131. {%- if pagination['prev'] > 0 %}<li><a href="{%- if pagination['prev'] > 1 %}{{ url('user_warnings', user=profile.id, username=profile.username_slug, page=pagination['prev']) }}{% else %}{{ url('user_warnings', user=profile.id, username=profile.username_slug) }}{% endif %}" class="tooltip-top" title="{% trans %}Newer Warnings{% endtrans %}"><i class="icon-chevron-left"></i></a></li>{% endif -%}
  132. {%- if pagination['next'] > 0 %}<li><a href="{{ url('user_warnings', user=profile.id, username=profile.username_slug, page=pagination['next']) }}" class="tooltip-top" title="{% trans %}Older Warnings{% endtrans %}"><i class="icon-chevron-right"></i></a></li>{% endif -%}
  133. </ul>
  134. </div>
  135. {% endif %}
  136. {%- endmacro %}