alerts.html 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 content %}
  10. <div class="page-header">
  11. <h1>{% if user.alerts %}{{ get_title() }} <small>{% trans %}Your Notifications{% endtrans %}</small>
  12. {%- else -%}
  13. {% trans %}Your Notifications{% endtrans %}{% endif %}</h1>
  14. </div>
  15. {% if alerts %}
  16. <div class="alerts-list">
  17. {% if alerts.today %}{{ alerts_list(_("Today Notifications"), alerts.today) }}{% endif %}
  18. {% if alerts.yesterday %}{{ alerts_list(_("Yesterday Notifications"), alerts.yesterday) }}{% endif %}
  19. {% if alerts.week %}{{ alerts_list(_("This Week Notifications"), alerts.week) }}{% endif %}
  20. {% if alerts.month %}{{ alerts_list(_("This Month Notifications"), alerts.month) }}{% endif %}
  21. {% if alerts.older %}{{ alerts_list(_("Older Notifications"), alerts.older) }}{% endif %}
  22. </div>
  23. {% else %}
  24. <p class="lead">{% trans %}Looks like you don't have any notifications... yet.{% endtrans %}</p>
  25. {% endif %}
  26. {% endblock %}
  27. {% macro get_title() -%}
  28. {% if new_alerts -%}
  29. {% trans count=new_alerts -%}
  30. You have one new alert
  31. {%- pluralize -%}
  32. You have {{ count }} new alerts
  33. {%- endtrans %}
  34. {%- else -%}
  35. {% trans %}Your Notifications{% endtrans %}
  36. {%- endif %}
  37. {%- endmacro %}
  38. {% macro alerts_list(title, alerts) %}
  39. <table class="table table-striped">
  40. <thead>
  41. <tr>
  42. <th>{{ title }}</th>
  43. <th class="span3">{% trans %}Date{% endtrans %}</th>
  44. </tr>
  45. </thead>
  46. <tbody>
  47. {% for alert in alerts %}
  48. <tr>
  49. <td>{% if alert.new %}<span class="label label-warning">{% trans %}New{% endtrans %}</span> {% endif %}{{ (_(alert.message) % alert.vars())|safe }}</td>
  50. <td class="muted">{{ alert.date|reltimesince }}</td>
  51. </tr>
  52. {% endfor %}
  53. </tbody>
  54. </table>
  55. {% endmacro %}