diff options
Diffstat (limited to 'templates/user/notification')
-rw-r--r-- | templates/user/notification/notification.tmpl | 3 | ||||
-rw-r--r-- | templates/user/notification/notification_div.tmpl | 130 | ||||
-rw-r--r-- | templates/user/notification/notification_subscriptions.tmpl | 84 |
3 files changed, 217 insertions, 0 deletions
diff --git a/templates/user/notification/notification.tmpl b/templates/user/notification/notification.tmpl new file mode 100644 index 0000000..b483c15 --- /dev/null +++ b/templates/user/notification/notification.tmpl @@ -0,0 +1,3 @@ +{{template "base/head" .}} +{{template "user/notification/notification_div" .}} +{{template "base/footer" .}} diff --git a/templates/user/notification/notification_div.tmpl b/templates/user/notification/notification_div.tmpl new file mode 100644 index 0000000..5c27ba8 --- /dev/null +++ b/templates/user/notification/notification_div.tmpl @@ -0,0 +1,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}} + {{RenderRefIssueTitle $.Context .Issue.Title}} + {{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> diff --git a/templates/user/notification/notification_subscriptions.tmpl b/templates/user/notification/notification_subscriptions.tmpl new file mode 100644 index 0000000..0a3ae99 --- /dev/null +++ b/templates/user/notification/notification_subscriptions.tmpl @@ -0,0 +1,84 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content user notification"> + <div class="ui container"> + <div class="tw-flex tw-items-center tw-justify-between tw-mb-4"> + <div class="ui secondary partial menu"> + <a href="{{AppSubUrl}}/notifications/subscriptions" class="{{if eq .Status 1}}active {{end}}item"> + {{ctx.Locale.Tr "notification.subscriptions"}} + </a> + <a href="{{AppSubUrl}}/notifications/watching" class="{{if eq .Status 2}}active {{end}}item"> + {{ctx.Locale.Tr "notification.watching"}} + </a> + </div> + <a class="ui tiny button" href="{{AppSubUrl}}/notifications"> + {{ctx.Locale.Tr "notifications"}} + </a> + </div> + <div class="ui bottom active tab segment"> + {{if eq .Status 1}} + <div class="tw-flex tw-justify-between"> + <div class="tw-flex"> + <div class="small-menu-items ui compact tiny menu"> + <a class="{{if eq .State "all"}}active {{end}}item" href="?sort={{$.SortType}}&state=all&issueType={{$.IssueType}}&labels={{$.Labels}}"> + {{ctx.Locale.Tr "all"}} + </a> + <a class="{{if eq .State "open"}}active {{end}}item" href="?sort={{$.SortType}}&state=open&issueType={{$.IssueType}}&labels={{$.Labels}}"> + {{svg "octicon-issue-opened" 16 "tw-mr-2"}} + {{ctx.Locale.Tr "repo.issues.open_title"}} + </a> + <a class="{{if eq .State "closed"}}active {{end}}item" href="?sort={{$.SortType}}&state=closed&issueType={{$.IssueType}}&labels={{$.Labels}}"> + {{svg "octicon-issue-closed" 16 "tw-mr-2"}} + {{ctx.Locale.Tr "repo.issues.closed_title"}} + </a> + </div> + </div> + <div class="tw-flex tw-justify-between"> + <div class="ui right aligned secondary filter menu labels"> + <!-- Type --> + <div class="ui dropdown type jump item"> + <span class="text"> + {{ctx.Locale.Tr "repo.issues.filter_type"}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <a class="{{if or (eq .IssueType "all") (not .IssueType)}}active {{end}}item" href="?sort={{$.SortType}}&state={{$.State}}&issueType=all&labels={{$.Labels}}">{{ctx.Locale.Tr "all"}}</a> + <a class="{{if eq .IssueType "issues"}}active {{end}}item" href="?sort={{$.SortType}}&state={{$.State}}&issueType=issues&labels={{$.Labels}}">{{ctx.Locale.Tr "issues"}}</a> + <a class="{{if eq .IssueType "pulls"}}active {{end}}item" href="?sort={{$.SortType}}&state={{$.State}}&issueType=pulls&labels={{$.Labels}}">{{ctx.Locale.Tr "pull_requests"}}</a> + </div> + </div> + + <!-- Sort --> + <div class="ui dropdown type jump item"> + <span class="text"> + {{ctx.Locale.Tr "repo.issues.filter_sort"}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <a class="{{if or (eq .SortType "latest") (not .SortType)}}active {{end}}item" href="?sort=latest&state={{$.State}}&issueType={{$.IssueType}}&labels={{$.Labels}}">{{ctx.Locale.Tr "repo.issues.filter_sort.latest"}}</a> + <a class="{{if eq .SortType "oldest"}}active {{end}}item" href="?sort=oldest&state={{$.State}}&issueType={{$.IssueType}}&labels={{$.Labels}}">{{ctx.Locale.Tr "repo.issues.filter_sort.oldest"}}</a> + <a class="{{if eq .SortType "recentupdate"}}active {{end}}item" href="?sort=recentupdate&state={{$.State}}&issueType={{$.IssueType}}&labels={{$.Labels}}">{{ctx.Locale.Tr "repo.issues.filter_sort.recentupdate"}}</a> + <a class="{{if eq .SortType "leastupdate"}}active {{end}}item" href="?sort=leastupdate&state={{$.State}}&issueType={{$.IssueType}}&labels={{$.Labels}}">{{ctx.Locale.Tr "repo.issues.filter_sort.leastupdate"}}</a> + <a class="{{if eq .SortType "mostcomment"}}active {{end}}item" href="?sort=mostcomment&state={{$.State}}&issueType={{$.IssueType}}&labels={{$.Labels}}">{{ctx.Locale.Tr "repo.issues.filter_sort.mostcomment"}}</a> + <a class="{{if eq .SortType "leastcomment"}}active {{end}}item" href="?sort=leastcomment&state={{$.State}}&issueType={{$.IssueType}}&labels={{$.Labels}}">{{ctx.Locale.Tr "repo.issues.filter_sort.leastcomment"}}</a> + <a class="{{if eq .SortType "nearduedate"}}active {{end}}item" href="?sort=nearduedate&state={{$.State}}&issueType={{$.IssueType}}&labels={{$.Labels}}">{{ctx.Locale.Tr "repo.issues.filter_sort.nearduedate"}}</a> + <a class="{{if eq .SortType "farduedate"}}active {{end}}item" href="?sort=farduedate&state={{$.State}}&issueType={{$.IssueType}}&labels={{$.Labels}}">{{ctx.Locale.Tr "repo.issues.filter_sort.farduedate"}}</a> + </div> + </div> + </div> + </div> + </div> + <div class="divider"></div> + {{if not .Issues}} + {{ctx.Locale.Tr "notification.no_subscriptions"}} + {{else}} + {{template "shared/issuelist" dict "." . "listType" "dashboard"}} + {{end}} + {{else}} + {{template "shared/repo_search" .}} + {{template "explore/repo_list" .}} + {{template "base/paginate" .}} + {{end}} + </div> + </div> +</div> +{{template "base/footer" .}} |