notifications.html
HTML document, Unicode text, UTF-8 text
1{% extends "default.html" %} 2{% block title %} 3{% trans %}Notifications{% endtrans %} 4{% endblock %} 5{% block breadcrumbs %} 6<li><a href="/notifications">{% trans %}Notifications{% endtrans %}</a></li> 7{% endblock %} 8{% block content %} 9<x-vbox> 10<x-frame style="--width: 896px;" class="flexible-space"> 11<x-vbox> 12{% if notifications %} 13<form method="post" action="/notifications/mark-all-read"> 14<button type="submit">{% trans %}Mark all as read{% endtrans %}</button> 15</form> 16{% for notification in notifications %} 17<article class="card card-horizontal"> 18<section class="card-main flexible-space"> 19{{ notification.notification.timestamp | strftime("%A, %e %B %Y, %H:%M:%S") }} 20{% if notification.notification.data["type"] == "welcome" %} 21<h2>{% trans %}Welcome{% endtrans %}</h2> 22{% elif notification.notification.data["type"] == "commit" %} 23{% set commit = db.session.get(Commit, notification.notification.data["repo"] + "/" + notification.notification.data["commit"]) %} 24<h2><a href="{{ notification.notification.data['repo'] + '/commit/' + notification.notification.data['commit'] }}">{{ commit.message | split("\n\n", 1) | first }}</a></h2> 25<p> 26{% trans %}Commited by{% endtrans %} <a href="/{{ commit.owner.username }}">{{ commit.owner.username }}</a> 27{% trans %}in{% endtrans %} <a href="{{ commit.repo.route }}">{{ commit.repo.owner.username }}/{{ commit.repo.name }}</a> 28</p> 29{% elif notification.notification.data["type"] == "post" %} 30{% set post = db.session.get(Post, notification.notification.data["post"]) %} 31<h2><a href="{{ notification.notification.data['repo'] + '/forum/' + post.number|string }}">{{ post.subject }}</a></h2> 32<p> 33{% trans %}Posted by{% endtrans %} <a href="/{{ post.owner.username }}">{{ post.owner.username }}</a> 34{% trans %}in{% endtrans %} <a href="{{ post.repo.route }}">{{ post.repo.owner.username }}/{{ post.repo.name }}</a> 35</p> 36{% elif notification.notification.data["type"] == "pr" %} 37{% set pr = db.session.get(PullRequest, notification.notification.data["pr"]|int) %} 38<h2><a href="{{ notification.notification.data['base'] + '/prs/' }}">{{ pr.head_route }}:{{ pr.head_branch }} → {{ pr.base_route }}:{{ pr.base_branch }}</a></h2> 39<p> 40{% trans %}Requested by{% endtrans %} <a href="/{{ pr.owner.username }}">{{ pr.owner.username }}</a> 41{% trans %}in{% endtrans %} <a href="{{ pr.base_route }}">{{ pr.base.username }}/{{ pr.base.name }}</a> 42</p> 43{% endif %} 44</section> 45<section> 46{% if notification.attention_level %} 47<button hx-post="/notifications/{{ notification.id }}/read" hx-swap="outerHTML"> 48{% trans %}Mark as read{% endtrans %} 49</button> 50{% else %} 51<button hx-post="/notifications/{{ notification.id }}/unread" hx-swap="outerHTML"> 52{% trans %}Mark as unread{% endtrans %} 53</button> 54{% endif %} 55</section> 56</article> 57{% endfor %} 58{% else %} 59<p>{% trans %}When you get notifications, they'll be shown here.{% endtrans %}</p> 60{% endif %} 61{% include "pagination.html" %} 62</x-vbox> 63</x-frame> 64</x-vbox> 65{% endblock %} 66