summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorAndrey Nering <andrey.nering@gmail.com>2017-01-12 02:27:09 -0200
committerLunny Xiao <xiaolunwen@gmail.com>2017-01-12 12:27:09 +0800
commit769e0a3ea6455cb908cd7167d651024ce5c7eee3 (patch)
tree55db340bdd5aa03cd5455df6d045007e7afdb5be /templates
parentcbf2a967c58780ee23ff66fff1b6699f9f765294 (diff)
downloadgitea-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')
-rw-r--r--templates/base/head.tmpl2
-rw-r--r--templates/user/notification/notification.tmpl76
2 files changed, 55 insertions, 23 deletions
diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl
index a0b5220fd2..e230436209 100644
--- a/templates/base/head.tmpl
+++ b/templates/base/head.tmpl
@@ -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>
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}}