full.html 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. {% extends "misago/base.html" %}
  2. {% load humanize i18n %}
  3. {% block title %}{% blocktrans trimmed with notifications=notifications_count|intcomma count counter=notifications_count %}
  4. You have {{ notifications }} notification
  5. {% plural %}
  6. You have {{ notifications }} notifications
  7. {% endblocktrans %} | {{ block.super }}{% endblock title %}
  8. {% block content %}
  9. <div class="page-header">
  10. <div class="container">
  11. <h1 class="pull-left">
  12. <span class="fa fa-bell-o"></span>
  13. {% if user.new_notifications %}
  14. {% blocktrans trimmed with notifications=user.new_notifications count counter=user.new_notifications%}
  15. You have {{ notifications }} new notification
  16. {% plural %}
  17. You have {{ notifications }} new notifications
  18. {% endblocktrans %}
  19. {% else %}
  20. {% blocktrans trimmed with notifications=notifications_count count counter=user.new_notifications%}
  21. You have {{ notifications }} notification
  22. {% plural %}
  23. You have {{ notifications }} notifications
  24. {% endblocktrans %}
  25. {% endif %}
  26. </h1>
  27. <div class="page-actions">
  28. <form method="post">
  29. {% csrf_token %}
  30. <button type="submit" name="read-all" class="btn btn-default">
  31. {% trans "Mark all read" %}
  32. </button>
  33. </form>
  34. </div>
  35. </div>
  36. </div>
  37. <div class="container">
  38. {% if notifications_count %}
  39. <ul class="list-unstyled notifications-list">
  40. {% for item in items %}
  41. <li{% if item.is_new %} class="new"{% endif %}>
  42. <div class="state-icon">
  43. {% if item.is_new %}
  44. <span class="fa fa-circle tooltip-top" title="{% trans "New notification" %}"></span>
  45. {% else %}
  46. <span class="fa fa-circle-o tooltip-top" title="{% trans "Old notification" %}"></span>
  47. {% endif %}
  48. </div>
  49. {% if item.is_valid %}
  50. <a href="{{ item.get_absolute_url }}" class="message">
  51. {{ item.message|safe }}
  52. </a>
  53. {% else %}
  54. <a href="#" class="message">
  55. <em>{% trans "Notification is not available." %}</em>
  56. </a>
  57. {% endif %}
  58. <form method="POST" class="read-form">
  59. {% csrf_token %}
  60. <input type="hidden" name="notification" value="{{ item.pk }}">
  61. <button type="submit" class="btn btn-default btn-sm"{% if not item.is_new %} disabled="disabled"{% endif %}>
  62. <span class="fa fa-check"></span>
  63. {% trans "Read" %}
  64. </button>
  65. </form>
  66. <footer class="text-muted">
  67. {% if item.sender_username %}
  68. {% if item.sender_id %}
  69. <a href="{% url USER_PROFILE_URL user_slug=item.sender_slug user_id=item.sender_id %}" class="item-title">{{ item.sender_username }}</a>
  70. {% else %}
  71. <strong class="item-title">{{ item.sender_username }}</strong>
  72. {% endif %}
  73. {% endif %}
  74. <abbr class="tooltip-top dynamic time-ago" title="{{ item.date }}" data-timestamp="{{ item.date|date:"c" }}">
  75. {{ item.date|date }}
  76. </abbr>
  77. </footer>
  78. </li>
  79. {% endfor %}
  80. </ul>
  81. {% else %}
  82. <p class="lead">
  83. {% trans "You don't have any notifications." %}
  84. </p>
  85. {% endif %}
  86. </div>
  87. {% endblock content %}
  88. {% block javascripts %}
  89. <script lang="JavaScript">
  90. $(function() {
  91. $('.read-form').submit(function() {
  92. var $form = $(this);
  93. $.post($form.attr('action'), $form.serialize(), function(data) {
  94. $row = $form.parents('li');
  95. $row.removeClass("new");
  96. $icon = $row.find('.state-icon .fa');
  97. $row.find('.btn').attr("disabled", "disabled");
  98. $icon.removeClass("fa-circle").addClass('fa-circle-o');
  99. $icon.attr("title", "{% trans "Old notification" %}");
  100. $.misago_dom().changed();
  101. });
  102. return false;
  103. });
  104. });
  105. </script>
  106. {% endblock javascripts %}