alerts.html 2.4 KB

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