You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

113 lines
4.0 KiB

7 years ago
7 years ago
  1. {{template "base/head" .}}
  2. <div class="user notification">
  3. <div class="ui container">
  4. <h1 class="ui dividing header">{{.i18n.Tr "notification.notifications"}}</h1>
  5. <div class="ui top attached tabular menu">
  6. <a href="{{AppSubUrl}}/notifications?q=unread">
  7. <div class="{{if eq .Status 1}}active{{end}} item">
  8. {{.i18n.Tr "notification.unread"}}
  9. {{if .NotificationUnreadCount}}
  10. <div class="ui label">{{.NotificationUnreadCount}}</div>
  11. {{end}}
  12. </div>
  13. </a>
  14. <a href="{{AppSubUrl}}/notifications?q=read">
  15. <div class="{{if eq .Status 2}}active{{end}} item">
  16. {{.i18n.Tr "notification.read"}}
  17. </div>
  18. </a>
  19. </div>
  20. <div class="ui bottom attached active tab segment">
  21. {{if eq (len .Notifications) 0}}
  22. {{if eq .Status 1}}
  23. {{.i18n.Tr "notification.no_unread"}}
  24. {{else}}
  25. {{.i18n.Tr "notification.no_read"}}
  26. {{end}}
  27. {{else}}
  28. <table class="ui unstackable striped very compact small selectable table">
  29. <tbody>
  30. {{range $notification := .Notifications}}
  31. {{$issue := $notification.GetIssue}}
  32. {{$repo := $notification.GetRepo}}
  33. {{$repoOwner := $repo.MustOwner}}
  34. <tr data-href="{{AppSubUrl}}/{{$repoOwner.Name}}/{{$repo.Name}}/issues/{{$issue.Index}}">
  35. <td class="collapsing">
  36. {{if eq $notification.Status 3}}
  37. <i class="blue octicon octicon-pin"></i>
  38. {{else if $issue.IsPull}}
  39. {{if $issue.IsClosed}}
  40. {{if $issue.GetPullRequest.HasMerged}}
  41. <i class="purple octicon octicon-git-merge"></i>
  42. {{else}}
  43. <i class="red octicon octicon-git-pull-request"></i>
  44. {{end}}
  45. {{else}}
  46. <i class="green octicon octicon-git-pull-request"></i>
  47. {{end}}
  48. {{else}}
  49. {{if $issue.IsClosed}}
  50. <i class="red octicon octicon-issue-closed"></i>
  51. {{else}}
  52. <i class="green octicon octicon-issue-opened"></i>
  53. {{end}}
  54. {{end}}
  55. </td>
  56. <td class="eleven wide">
  57. <a class="item" href="{{AppSubUrl}}/{{$repoOwner.Name}}/{{$repo.Name}}/issues/{{$issue.Index}}">
  58. #{{$issue.Index}} - {{$issue.Title}}
  59. </a>
  60. </td>
  61. <td>
  62. <a class="item" href="{{AppSubUrl}}/{{$repoOwner.Name}}/{{$repo.Name}}">
  63. {{$repoOwner.Name}}/{{$repo.Name}}
  64. </a>
  65. </td>
  66. <td class="collapsing">
  67. {{if ne $notification.Status 3}}
  68. <form action="{{AppSubUrl}}/notifications/status" method="POST">
  69. {{$.CsrfTokenHtml}}
  70. <input type="hidden" name="notification_id" value="{{$notification.ID}}" />
  71. <input type="hidden" name="status" value="pinned" />
  72. <button class="ui mini button" title='{{$.i18n.Tr "notification.pin"}}'>
  73. <i class="octicon octicon-pin"></i>
  74. </button>
  75. </form>
  76. {{end}}
  77. </td>
  78. <td class="collapsing">
  79. {{if or (eq $notification.Status 1) (eq $notification.Status 3)}}
  80. <form action="{{AppSubUrl}}/notifications/status" method="POST">
  81. {{$.CsrfTokenHtml}}
  82. <input type="hidden" name="notification_id" value="{{$notification.ID}}" />
  83. <input type="hidden" name="status" value="read" />
  84. <button class="ui mini button" title='{{$.i18n.Tr "notification.mark_as_read"}}'>
  85. <i class="octicon octicon-check"></i>
  86. </button>
  87. </form>
  88. {{else if eq $notification.Status 2}}
  89. <form action="{{AppSubUrl}}/notifications/status" method="POST">
  90. {{$.CsrfTokenHtml}}
  91. <input type="hidden" name="notification_id" value="{{$notification.ID}}" />
  92. <input type="hidden" name="status" value="unread" />
  93. <button class="ui mini button" title='{{$.i18n.Tr "notification.mark_as_unread"}}'>
  94. <i class="octicon octicon-bell"></i>
  95. </button>
  96. </form>
  97. {{end}}
  98. </td>
  99. </tr>
  100. {{end}}
  101. </tbody>
  102. </table>
  103. {{end}}
  104. </div>
  105. {{template "base/paginate" .}}
  106. </div>
  107. </div>
  108. {{template "base/footer" .}}