You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
3.6 KiB

4 years ago
  1. {% extends 'base.html' %}
  2. {% from 'bootstrap/pagination.html' import render_pagination %}
  3. {% block title %}通知{% endblock %}
  4. {% block content %}
  5. <div class="page-header">
  6. <h1>通知</h1>
  7. </div>
  8. <div class="row">
  9. <div class="col-md-3">
  10. <div class="nav nav-pills flex-column" role="tablist" aria-orientation="vertical">
  11. <a class="nav-item nav-link {% if request.args.get('filter') != 'unread' %}active{% endif %}"
  12. href="{{ url_for('.show_notifications', filter='all') }}">
  13. 全部
  14. </a>
  15. <a class="nav-item nav-link {% if request.args.get('filter') == 'unread' %}active{% endif %}"
  16. href="{{ url_for('.show_notifications', filter='unread') }}">
  17. 未读
  18. </a>
  19. </div>
  20. </div>
  21. <div class="col-md-9">
  22. <div class="card bg-light w-100">
  23. <div class="card-header">{{ notification_count }} 条未读通知
  24. <div class="float-right">
  25. <a class="btn btn-light btn-sm" href="{{ url_for('user.notification_setting') }}">
  26. <span class="oi oi-cog" aria-hidden="true"></span> 设置
  27. </a>
  28. <form class="inline" method="post" action="{{ url_for('.read_all_notification') }}">
  29. <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
  30. <button type="submit" class="btn btn-light btn-sm">
  31. <span class="oi oi-check" aria-hidden="true"></span> 全部已读
  32. </button>
  33. </form>
  34. </div>
  35. </div>
  36. <div class="card-body">
  37. {% if notifications %}
  38. <ul class="list-group">
  39. {% for notification in notifications %}
  40. <li class="list-group-item">
  41. {{ notification.message|safe }}
  42. <span class="float-right">
  43. {{ moment(notification.timestamp).fromNow(refresh=True) }}
  44. {% if notification.is_read == False %}
  45. <form class="inline"
  46. action="{{ url_for('.read_notification', notification_id=notification.id) }}"
  47. method="post">
  48. <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
  49. <button type="submit" class="btn btn-light btn-sm">
  50. <span class="oi oi-check" aria-hidden="true"></span>
  51. </button>
  52. </form>
  53. {% endif %}
  54. </span>
  55. </li>
  56. {% endfor %}
  57. </ul>
  58. <div class="text-right page-footer">
  59. {{ render_pagination(pagination) }}
  60. </div>
  61. {% else %}
  62. <div class="tip text-center">
  63. <h6>无通知</h6>
  64. </div>
  65. {% endif %}
  66. </div>
  67. </div>
  68. </div>
  69. </div>
  70. {% endblock %}