summaryrefslogtreecommitdiffstats
path: root/templates/user/notification/notification_div.tmpl
blob: 4329ffdb7a97a4127491f3251aa68b07d791c896 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<div role="main" aria-label="{{.Title}}" class="page-content user notification" id="notification_div" data-sequence-number="{{.SequenceNumber}}">
	<div class="ui container">
		{{$notificationUnreadCount := call .NotificationUnreadCount}}
		<div class="tw-flex tw-items-center tw-justify-between tw-mb-4">
			<div class="ui secondary partial menu">
				<a class="{{if eq .Status 1}}active {{end}}item" href="{{AppSubUrl}}/notifications?q=unread">
					{{ctx.Locale.Tr "notification.unread"}}
					<div class="notifications-unread-count ui label {{if not $notificationUnreadCount}}tw-hidden{{end}}">{{$notificationUnreadCount}}</div>
				</a>
				<a class="{{if eq .Status 2}}active {{end}}item" href="{{AppSubUrl}}/notifications?q=read">
					{{ctx.Locale.Tr "notification.read"}}
				</a>
			</div>
			<div class="tw-flex button-row">
				<a class="ui tiny button" href="{{AppSubUrl}}/notifications/subscriptions">
					{{ctx.Locale.Tr "notification.subscriptions"}}
				</a>
				{{if and (eq .Status 1)}}
					<form class="{{if not $notificationUnreadCount}}tw-hidden{{end}}" action="{{AppSubUrl}}/notifications/purge" method="post">
						{{$.CsrfTokenHtml}}
						<div>
							<button class="ui mini button primary tw-mr-0" title="{{ctx.Locale.Tr "notification.mark_all_as_read"}}">
								{{svg "octicon-checklist"}}
							</button>
						</div>
					</form>
				{{end}}
			</div>
		</div>
		<div class="tw-p-0">
			<div id="notification_table">
				{{if not .Notifications}}
					<div class="tw-flex tw-items-center tw-flex-col tw-p-4">
						{{svg "octicon-inbox" 56 "tw-mb-4"}}
						{{if eq .Status 1}}
							{{ctx.Locale.Tr "notification.no_unread"}}
						{{else}}
							{{ctx.Locale.Tr "notification.no_read"}}
						{{end}}
					</div>
				{{else}}
					{{range $notification := .Notifications}}
						<div class="notifications-item tw-flex tw-items-center tw-flex-wrap tw-gap-2 tw-p-2" id="notification_{{.ID}}" data-status="{{.Status}}">
							<div class="notifications-icon tw-ml-2 tw-mr-1 tw-self-start tw-mt-1">
								{{if .Issue}}
									{{template "shared/issueicon" .Issue}}
								{{else}}
									{{svg "octicon-repo" 16 "text grey"}}
								{{end}}
							</div>
							<a class="notifications-link tw-flex tw-flex-1 tw-flex-col silenced" href="{{.Link ctx}}">
								<div class="notifications-top-row tw-text-13 tw-break-anywhere">
									{{.Repository.FullName}} {{if .Issue}}<span class="text light-3">#{{.Issue.Index}}</span>{{end}}
									{{if eq .Status 3}}
										{{svg "octicon-pin" 13 "text blue tw-mt-0.5 tw-ml-1"}}
									{{end}}
								</div>
								<div class="notifications-bottom-row tw-text-16 tw-py-0.5">
									<span class="issue-title tw-break-anywhere">
										{{if .Issue}}
											{{.Issue.Title | RenderEmoji $.Context | RenderCodeBlock}}
										{{else}}
											{{.Repository.FullName}}
										{{end}}
									</span>
								</div>
							</a>
							<div class="notifications-updated tw-items-center tw-mr-2">
								{{if .Issue}}
									{{TimeSinceUnix .Issue.UpdatedUnix ctx.Locale}}
								{{else}}
									{{TimeSinceUnix .UpdatedUnix ctx.Locale}}
								{{end}}
							</div>
							<div class="notifications-buttons tw-items-center tw-justify-end tw-gap-1 tw-px-1">
								{{if ne .Status 3}}
									<form action="{{AppSubUrl}}/notifications/status" method="post">
										{{$.CsrfTokenHtml}}
										<input type="hidden" name="notification_id" value="{{.ID}}">
										<input type="hidden" name="status" value="pinned">
										<button class="btn interact-bg tw-p-2" title="{{ctx.Locale.Tr "notification.pin"}}"
											data-url="{{AppSubUrl}}/notifications/status"
											data-status="pinned"
											data-page="{{$.Page.Paginater.Current}}"
											data-notification-id="{{.ID}}"
											data-q="{{$.Keyword}}">
											{{svg "octicon-pin"}}
										</button>
									</form>
								{{end}}
								{{if or (eq .Status 1) (eq .Status 3)}}
									<form action="{{AppSubUrl}}/notifications/status" method="post">
										{{$.CsrfTokenHtml}}
										<input type="hidden" name="notification_id" value="{{.ID}}">
										<input type="hidden" name="status" value="read">
										<input type="hidden" name="page" value="{{$.Page.Paginater.Current}}">
										<button class="btn interact-bg tw-p-2" title="{{ctx.Locale.Tr "notification.mark_as_read"}}"
											data-url="{{AppSubUrl}}/notifications/status"
											data-status="read"
											data-page="{{$.Page.Paginater.Current}}"
											data-notification-id="{{.ID}}"
											data-q="{{$.Keyword}}">
											{{svg "octicon-check"}}
										</button>
									</form>
								{{else if eq .Status 2}}
									<form action="{{AppSubUrl}}/notifications/status" method="post">
										{{$.CsrfTokenHtml}}
										<input type="hidden" name="notification_id" value="{{.ID}}">
										<input type="hidden" name="status" value="unread">
										<input type="hidden" name="page" value="{{$.Page.Paginater.Current}}">
										<button class="btn interact-bg tw-p-2" title="{{ctx.Locale.Tr "notification.mark_as_unread"}}"
											data-url="{{AppSubUrl}}/notifications/status"
											data-status="unread"
											data-page="{{$.Page.Paginater.Current}}"
											data-notification-id="{{.ID}}"
											data-q="{{$.Keyword}}">
											{{svg "octicon-bell"}}
										</button>
									</form>
								{{end}}
							</div>
						</div>
					{{end}}
				{{end}}
			</div>
		</div>
		{{template "base/paginate" .}}
	</div>
</div>