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.

notification_div.tmpl 5.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <div role="main" aria-label="{{.Title}}" class="page-content user notification" id="notification_div" data-params="{{.Page.GetParams}}" data-sequence-number="{{.SequenceNumber}}">
  2. <div class="ui container">
  3. <h1 class="ui dividing header">{{.locale.Tr "notification.notifications"}}</h1>
  4. <div class="ui top attached tabular menu">
  5. {{$notificationUnreadCount := call .NotificationUnreadCount}}
  6. <a href="{{AppSubUrl}}/notifications?q=unread" class="{{if eq .Status 1}}active {{end}}item">
  7. {{.locale.Tr "notification.unread"}}
  8. <div class="ui label {{if not $notificationUnreadCount}}gt-hidden{{end}}">{{$notificationUnreadCount}}</div>
  9. </a>
  10. <a href="{{AppSubUrl}}/notifications?q=read" class="{{if eq .Status 2}}active {{end}}item">
  11. {{.locale.Tr "notification.read"}}
  12. </a>
  13. {{if and (eq .Status 1)}}
  14. <form action="{{AppSubUrl}}/notifications/purge" method="POST" style="margin-left: auto;">
  15. {{$.CsrfTokenHtml}}
  16. <div class="{{if not $notificationUnreadCount}}gt-hidden{{end}}">
  17. <button class="ui mini button primary" title='{{$.locale.Tr "notification.mark_all_as_read"}}'>
  18. {{svg "octicon-checklist"}}
  19. </button>
  20. </div>
  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. {{.locale.Tr "notification.no_unread"}}
  28. {{else}}
  29. {{.locale.Tr "notification.no_read"}}
  30. {{end}}
  31. {{else}}
  32. <table class="ui unstackable striped very compact small selectable table" id="notification_table">
  33. <tbody>
  34. {{range $notification := .Notifications}}
  35. {{$issue := .Issue}}
  36. {{$repo := .Repository}}
  37. <tr id="notification_{{.ID}}">
  38. <td class="collapsing gt-pl-4">
  39. {{if eq .Status 3}}
  40. {{svg "octicon-pin" 16 "text blue"}}
  41. {{else if not $issue}}
  42. {{svg "octicon-repo" 16 "text grey"}}
  43. {{else if $issue.IsPull}}
  44. {{if $issue.IsClosed}}
  45. {{if $issue.GetPullRequest.HasMerged}}
  46. {{svg "octicon-git-merge" 16 "text purple"}}
  47. {{else}}
  48. {{svg "octicon-git-pull-request" 16 "text red"}}
  49. {{end}}
  50. {{else}}
  51. {{svg "octicon-git-pull-request" 16 "text green"}}
  52. {{end}}
  53. {{else}}
  54. {{if $issue.IsClosed}}
  55. {{svg "octicon-issue-closed" 16 "text red"}}
  56. {{else}}
  57. {{svg "octicon-issue-opened" 16 "text green"}}
  58. {{end}}
  59. {{end}}
  60. </td>
  61. <td class="eleven wide">
  62. <a class="item" href="{{.Link}}">
  63. {{if $issue}}
  64. #{{$issue.Index}} - {{$issue.Title}}
  65. {{else}}
  66. {{$repo.FullName}}
  67. {{end}}
  68. </a>
  69. </td>
  70. <td>
  71. <a class="item" href="{{$repo.Link}}">{{$repo.FullName}}</a>
  72. </td>
  73. <td class="collapsing">
  74. {{if ne .Status 3}}
  75. <form action="{{AppSubUrl}}/notifications/status" method="POST">
  76. {{$.CsrfTokenHtml}}
  77. <input type="hidden" name="notification_id" value="{{.ID}}">
  78. <input type="hidden" name="status" value="pinned">
  79. <button class="ui mini button" title='{{$.locale.Tr "notification.pin"}}'
  80. data-url="{{AppSubUrl}}/notifications/status"
  81. data-status="pinned"
  82. data-page="{{$.Page.Paginater.Current}}"
  83. data-notification-id="{{.ID}}"
  84. data-q="{{$.Keyword}}">
  85. {{svg "octicon-pin"}}
  86. </button>
  87. </form>
  88. {{end}}
  89. </td>
  90. <td class="collapsing">
  91. {{if or (eq .Status 1) (eq .Status 3)}}
  92. <form action="{{AppSubUrl}}/notifications/status" method="POST">
  93. {{$.CsrfTokenHtml}}
  94. <input type="hidden" name="notification_id" value="{{.ID}}">
  95. <input type="hidden" name="status" value="read">
  96. <input type="hidden" name="page" value="{{$.Page.Paginater.Current}}">
  97. <button class="ui mini button" title='{{$.locale.Tr "notification.mark_as_read"}}'
  98. data-url="{{AppSubUrl}}/notifications/status"
  99. data-status="read"
  100. data-page="{{$.Page.Paginater.Current}}"
  101. data-notification-id="{{.ID}}"
  102. data-q="{{$.Keyword}}">
  103. {{svg "octicon-check"}}
  104. </button>
  105. </form>
  106. {{else if eq .Status 2}}
  107. <form action="{{AppSubUrl}}/notifications/status" method="POST">
  108. {{$.CsrfTokenHtml}}
  109. <input type="hidden" name="notification_id" value="{{.ID}}">
  110. <input type="hidden" name="status" value="unread">
  111. <input type="hidden" name="page" value="{{$.Page.Paginater.Current}}">
  112. <button class="ui mini button" title='{{$.locale.Tr "notification.mark_as_unread"}}'
  113. data-url="{{AppSubUrl}}/notifications/status"
  114. data-status="unread"
  115. data-page="{{$.Page.Paginater.Current}}"
  116. data-notification-id="{{.ID}}"
  117. data-q="{{$.Keyword}}">
  118. {{svg "octicon-bell"}}
  119. </button>
  120. </form>
  121. {{end}}
  122. </td>
  123. </tr>
  124. {{end}}
  125. </tbody>
  126. </table>
  127. {{end}}
  128. </div>
  129. {{template "base/paginate" .}}
  130. </div>
  131. </div>