diff options
author | Andrey Nering <andrey.nering@gmail.com> | 2017-01-12 02:27:09 -0200 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2017-01-12 12:27:09 +0800 |
commit | 769e0a3ea6455cb908cd7167d651024ce5c7eee3 (patch) | |
tree | 55db340bdd5aa03cd5455df6d045007e7afdb5be /templates/user/notification | |
parent | cbf2a967c58780ee23ff66fff1b6699f9f765294 (diff) | |
download | gitea-769e0a3ea6455cb908cd7167d651024ce5c7eee3.tar.gz gitea-769e0a3ea6455cb908cd7167d651024ce5c7eee3.zip |
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
Diffstat (limited to 'templates/user/notification')
-rw-r--r-- | templates/user/notification/notification.tmpl | 76 |
1 files changed, 54 insertions, 22 deletions
diff --git a/templates/user/notification/notification.tmpl b/templates/user/notification/notification.tmpl index ddfcd4f717..3e5c0b7104 100644 --- a/templates/user/notification/notification.tmpl +++ b/templates/user/notification/notification.tmpl @@ -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}} + <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> + + {{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}} - {{if $issue.IsClosed}} - <i class="octicon octicon-issue-closed"></i> - {{else}} - <i class="octicon octicon-issue-opened"></i> - {{end}} + <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> - </div> + <div class="content"> + <div class="header">{{$repoOwner.Name}}/{{$repo.Name}}</div> + <div class="description">#{{$issue.Index}} - {{$issue.Title}}</div> + </div> + </a> {{end}} </div> {{end}} |