Notifications: mark as read/unread and pin (#629)
* Use relative URLs * Notifications - Mark as read/unread * Feature of pinning a notification * On view issue, do not mark as read a pinned notification
This commit is contained in:
parent
cbf2a967c5
commit
769e0a3ea6
8 changed files with 169 additions and 32 deletions
|
@ -82,7 +82,7 @@
|
|||
|
||||
{{if .IsSigned}}
|
||||
<div class="right menu">
|
||||
<a href="/notifications" class="ui head link jump item poping up" data-content='{{.i18n.Tr "notifications"}}' data-variation="tiny inverted">
|
||||
<a href="{{$.AppSubUrl}}/notifications" class="ui head link jump item poping up" data-content='{{.i18n.Tr "notifications"}}' data-variation="tiny inverted">
|
||||
<span class="text">
|
||||
<i class="octicon octicon-inbox"><span class="sr-only">{{.i18n.Tr "notifications"}}</span></i>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<h1 class="ui header">{{.i18n.Tr "notification.notifications"}}</h1>
|
||||
|
||||
<div class="ui top attached tabular menu">
|
||||
<a href="/notifications?q=unread">
|
||||
<a href="{{$.AppSubUrl}}/notifications?q=unread">
|
||||
<div class="{{if eq .Status 1}}active{{end}} item">
|
||||
{{.i18n.Tr "notification.unread"}}
|
||||
{{if eq .Status 1}}
|
||||
|
@ -13,7 +13,7 @@
|
|||
{{end}}
|
||||
</div>
|
||||
</a>
|
||||
<a href="/notifications?q=read">
|
||||
<a href="{{$.AppSubUrl}}/notifications?q=read">
|
||||
<div class="{{if eq .Status 2}}active{{end}} item">
|
||||
{{.i18n.Tr "notification.read"}}
|
||||
{{if eq .Status 2}}
|
||||
|
@ -30,34 +30,66 @@
|
|||
{{.i18n.Tr "notification.no_read"}}
|
||||
{{end}}
|
||||
{{else}}
|
||||
<div class="ui relaxed divided list">
|
||||
<div class="ui relaxed divided selection list">
|
||||
{{range $notification := .Notifications}}
|
||||
{{$issue := $notification.GetIssue}}
|
||||
{{$repo := $notification.GetRepo}}
|
||||
{{$repoOwner := $repo.MustOwner}}
|
||||
|
||||
<div class="item">
|
||||
<a href="{{$.AppSubUrl}}/{{$repoOwner.Name}}/{{$repo.Name}}/issues/{{$issue.Index}}">
|
||||
{{if and $issue.IsPull}}
|
||||
{{if $issue.IsClosed}}
|
||||
<i class="octicon octicon-git-merge"></i>
|
||||
{{else}}
|
||||
<i class="octicon octicon-git-pull-request"></i>
|
||||
{{end}}
|
||||
{{else}}
|
||||
{{if $issue.IsClosed}}
|
||||
<i class="octicon octicon-issue-closed"></i>
|
||||
{{else}}
|
||||
<i class="octicon octicon-issue-opened"></i>
|
||||
{{end}}
|
||||
<a class="item" href="{{$.AppSubUrl}}/{{$repoOwner.Name}}/{{$repo.Name}}/issues/{{$issue.Index}}">
|
||||
<div class="buttons-panel right floated content">
|
||||
{{if ne $notification.Status 3}}
|
||||
<form action="{{$.AppSubUrl}}/notifications/status" method="POST">
|
||||
{{$.CsrfTokenHtml}}
|
||||
<input type="hidden" name="notification_id" value="{{$notification.ID}}" />
|
||||
<input type="hidden" name="status" value="pinned" />
|
||||
<button class="ui button" title="Pin notification">
|
||||
<i class="octicon octicon-pin"></i>
|
||||
</button>
|
||||
</form>
|
||||
{{end}}
|
||||
{{if or (eq $notification.Status 1) (eq $notification.Status 3)}}
|
||||
<form action="{{$.AppSubUrl}}/notifications/status" method="POST">
|
||||
{{$.CsrfTokenHtml}}
|
||||
<input type="hidden" name="notification_id" value="{{$notification.ID}}" />
|
||||
<input type="hidden" name="status" value="read" />
|
||||
<button class="ui button" title="Mark as read">
|
||||
<i class="octicon octicon-check"></i>
|
||||
</button>
|
||||
</form>
|
||||
{{else if eq $notification.Status 2}}
|
||||
<form action="{{$.AppSubUrl}}/notifications/status" method="POST">
|
||||
{{$.CsrfTokenHtml}}
|
||||
<input type="hidden" name="notification_id" value="{{$notification.ID}}" />
|
||||
<input type="hidden" name="status" value="unread" />
|
||||
<button class="ui button" title="Mark as unread">
|
||||
<i class="octicon octicon-bell"></i>
|
||||
</button>
|
||||
</form>
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
<div class="content">
|
||||
<div class="header">{{$repoOwner.Name}}/{{$repo.Name}}</div>
|
||||
<div class="description">#{{$issue.Index}} - {{$issue.Title}}</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
{{if eq $notification.Status 3}}
|
||||
<i class="blue octicon octicon-pin"></i>
|
||||
{{else if $issue.IsPull}}
|
||||
{{if $issue.IsClosed}}
|
||||
<i class="octicon octicon-git-merge"></i>
|
||||
{{else}}
|
||||
<i class="octicon octicon-git-pull-request"></i>
|
||||
{{end}}
|
||||
{{else}}
|
||||
{{if $issue.IsClosed}}
|
||||
<i class="octicon octicon-issue-closed"></i>
|
||||
{{else}}
|
||||
<i class="octicon octicon-issue-opened"></i>
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
||||
<div class="content">
|
||||
<div class="header">{{$repoOwner.Name}}/{{$repo.Name}}</div>
|
||||
<div class="description">#{{$issue.Index}} - {{$issue.Title}}</div>
|
||||
</div>
|
||||
</a>
|
||||
{{end}}
|
||||
</div>
|
||||
{{end}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue