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.

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