alerts.html 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. {% extends "cranefly/layout.html" %}
  2. {% load i18n %}
  3. {% import "cranefly/macros.html" as macros with context %}
  4. {% block title %}{% if user.alerts -%}
  5. {{ macros.page_title(title=get_title(),parent=_('Your Notifications')) }}
  6. {%- else -%}
  7. {{ macros.page_title(title=get_title()) }}
  8. {%- endif %}{% endblock %}
  9. {% block container %}
  10. <div class="page-header header-primary">
  11. <div class="container">
  12. {% if messages %}
  13. <div class="messages-list">
  14. {{ messages_list(messages) }}
  15. </div>
  16. {% endif %}
  17. <h1>{% if user.alerts %}{{ get_title() }} <small>{% trans %}Your Notifications{% endtrans %}</small>
  18. {%- else -%}
  19. {% trans %}Your Notifications{% endtrans %}{% endif %}</h1>
  20. </div>
  21. </div>
  22. <div class="container container-primary">
  23. {% if alerts %}
  24. <div class="user-alerts">
  25. {% if alerts.today %}{{ alerts_list(_("Today Notifications"), alerts.today) }}{% endif %}
  26. {% if alerts.yesterday %}{{ alerts_list(_("Yesterday Notifications"), alerts.yesterday) }}{% endif %}
  27. {% if alerts.week %}{{ alerts_list(_("This Week"), alerts.week) }}{% endif %}
  28. {% if alerts.month %}{{ alerts_list(_("This Month"), alerts.month) }}{% endif %}
  29. {% if alerts.older %}{{ alerts_list(_("Older Notifications"), alerts.older) }}{% endif %}
  30. </div>
  31. {% else %}
  32. <p class="lead">{% trans %}Looks like you don't have any notifications... yet.{% endtrans %}</p>
  33. {% endif %}
  34. </div>
  35. {% endblock %}
  36. {% macro get_title() -%}
  37. {% if new_alerts -%}
  38. {% trans count=new_alerts -%}
  39. You have one new alert
  40. {%- pluralize -%}
  41. You have {{ count }} new alerts
  42. {%- endtrans %}
  43. {%- else -%}
  44. {% trans %}Your Notifications{% endtrans %}
  45. {%- endif %}
  46. {%- endmacro %}
  47. {% macro alerts_list(title, alerts) %}
  48. <table class="table table-striped">
  49. <thead>
  50. <tr>
  51. <th style="width: 1%;">&nbsp;</th>
  52. <th colspan="2">{{ title }}</th>
  53. </tr>
  54. </thead>
  55. <tbody>
  56. {% for alert in alerts %}
  57. <tr>
  58. <td class="alert-icon"><span class="label {% if alert.new %} label-warning{% endif %} tooltip-top" title="{% if alert.new %}{% trans %}New notification{% endtrans %}{% else %}{% trans %}Old notification{% endtrans %}{% endif %}"><i class="icon-fire"></i></label></td>
  59. <td class="alert-message">{{ (_(alert.message) % alert.vars())|safe }}</td>
  60. <td class="alert-date">{{ alert.date|reltimesince }}</td>
  61. </tr>
  62. {% endfor %}
  63. </tbody>
  64. </table>
  65. {% endmacro %}