warnings.html 5.5 KB

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