warnings.html 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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 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, item) and not warnings_tracker.is_warning_expired(item) %}
  60. <form>
  61. <button type="submit" class="btn btn-small"><i class="icon-ban"></i> {% trans %}Cancel{% endtrans %}</button>
  62. </form>
  63. {% endif %}
  64. {% if acl.warnings.can_delete_warnings() %}
  65. <form>
  66. <button type="submit" class="btn btn-small"><i class="icon-remove"></i> {% trans %}Delete{% endtrans %}</button>
  67. </form>
  68. {% endif %}
  69. <p>
  70. {% if acl.users.can_see_users_trails() %}
  71. {% trans user=warning_giver(item), date=item.given_on|reltimesince|low, ip=item.giver_ip %}Given by {{ user }} {{ date }} from ip {{ ip }}.{% endtrans %}
  72. {% else %}
  73. {% trans user=warning_giver(item), date=item.given_on|reltimesince|low %}Given by {{ user }} {{ date }}.{% endtrans %}
  74. {% endif %}
  75. {% if item.canceled %}
  76. {% if acl.users.can_see_users_trails() %}
  77. {% trans user=warning_canceler(item), date=item.canceled_on|reltimesince|low, ip=item.canceler_ip %}Canceled by {{ user }} {{ date }} from ip {{ ip }}.{% endtrans %}
  78. {% else %}
  79. {% trans user=warning_canceler(item), date=item.canceled_on|reltimesince|low %}Canceled by {{ user }} {{ date }}.{% endtrans %}
  80. {% endif %}
  81. {% endif %}
  82. </p>
  83. </div>
  84. </div>
  85. </div>
  86. <hr>
  87. {% endfor %}
  88. {{ pager() }}
  89. </div>
  90. {% endif %}
  91. {% endblock %}
  92. {% macro format_warning_expiration(expires) %}
  93. <strong>{{ expires }}</strong>
  94. {% endmacro %}
  95. {% macro warning_giver(item) -%}
  96. {% if item.giver_id %}
  97. <a href="{{ url('user', user=item.giver_id, username=item.giver_slug) }}">{{ item.giver_username }}</a>
  98. {% else %}
  99. <strong>{{ item.giver_username }}</strong>
  100. {% endif %}
  101. {%- endmacro %}
  102. {% macro warning_canceler(item) -%}
  103. {% if item.canceler_id %}
  104. <a href="{{ url('user', user=item.canceler_id, username=item.canceler_slug) }}">{{ item.canceler_username }}</a>
  105. {% else %}
  106. <strong>{{ item.canceler_username }}</strong>
  107. {% endif %}
  108. {%- endmacro %}
  109. {% macro pager() -%}
  110. {% if pagination['total'] > 1 %}
  111. <div class="pagination">
  112. <ul>
  113. <li class="count">{{ macros.pager_label(pagination) }}</li>
  114. {%- 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 -%}
  115. {%- 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 -%}
  116. {%- 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 -%}
  117. </ul>
  118. </div>
  119. {% endif %}
  120. {%- endmacro %}