By using this site, you agree to have cookies stored on your device, strictly for functional purposes, such as storing your session and preferences.

Dismiss

 notifications.html

View raw Download
text/html • 5.18 kiB
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
{% if notification.notification %}
20
{{ notification.notification.timestamp | strftime("%A, %e %B %Y, %H:%M:%S") }}
21
{% if notification.notification.data["type"] == "welcome" %}
22
<h2>{% trans %}Welcome{% endtrans %}</h2>
23
{% elif notification.notification.data["type"] == "commit" %}
24
{% set commit = db.session.get(Commit, notification.notification.data["repo"] + "/" + notification.notification.data["commit"]) %}
25
<h2><a href="{{ notification.notification.data['repo'] + '/commit/' + notification.notification.data['commit'] }}">{{ commit.message | split("\n\n", 1) | first }}</a></h2>
26
<p>
27
{% trans %}Commited by{% endtrans %} <a href="/{{ commit.owner.username }}">{{ commit.owner.username }}</a>
28
{% trans %}in{% endtrans %} <a href="{{ commit.repo.route }}">{{ commit.repo.owner.username }}/{{ commit.repo.name }}</a>
29
</p>
30
{% elif notification.notification.data["type"] == "post" %}
31
{% set post = db.session.get(Post, notification.notification.data["post"]) %}
32
<h2><a href="{{ notification.notification.data['repo'] + '/forum/' + post.number|string }}">{{ post.subject }}</a></h2>
33
<p>
34
{% trans %}Posted by{% endtrans %} <a href="/{{ post.owner.username }}">{{ post.owner.username }}</a>
35
{% trans %}in{% endtrans %} <a href="{{ post.repo.route }}">{{ post.repo.owner.username }}/{{ post.repo.name }}</a>
36
</p>
37
{% elif notification.notification.data["type"] == "pr" %}
38
{% set pr = db.session.get(PullRequest, notification.notification.data["pr"]|int) %}
39
<h2><a href="{{ notification.notification.data['base'] + '/prs/' }}">{{ pr.head_route }}:{{ pr.head_branch }} → {{ pr.base_route }}:{{ pr.base_branch }}</a></h2>
40
<p>
41
{% trans %}Requested by{% endtrans %} <a href="/{{ pr.owner.username }}">{{ pr.owner.username }}</a>
42
{% trans %}in{% endtrans %} <a href="{{ pr.base_route }}">{{ pr.base.username }}/{{ pr.base.name }}</a>
43
</p>
44
{% elif notification.notification.data["type"] == "follow" %}
45
{% set author = db.session.get(User, notification.notification.data["author"]) %}
46
<h2><a href="/{{ author.username }}">{{ author.username }}</a></h2>
47
<p>
48
{% trans %}is now following you{% endtrans %}
49
</p>
50
{% endif %}
51
{% endif %}
52
</section>
53
<section>
54
{% if notification.attention_level %}
55
<button hx-post="/notifications/{{ notification.id }}/read" hx-swap="outerHTML">
56
{% trans %}Mark as read{% endtrans %}
57
</button>
58
{% else %}
59
<button hx-post="/notifications/{{ notification.id }}/unread" hx-swap="outerHTML">
60
{% trans %}Mark as unread{% endtrans %}
61
</button>
62
{% endif %}
63
</section>
64
</article>
65
{% endfor %}
66
{% else %}
67
<p>{% trans %}When you get notifications, they'll be shown here.{% endtrans %}</p>
68
{% endif %}
69
{% include "pagination.html" %}
70
</x-vbox>
71
</x-frame>
72
</x-vbox>
73
{% endblock %}
74