category_entries.html 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. {{ define "title"}}{{ .category.Title }} ({{ .total }}){{ end }}
  2. {{ define "page_header"}}
  3. <section class="page-header" aria-labelledby="page-header-title">
  4. <h1 id="page-header-title" dir="auto">
  5. {{ .category.Title }}
  6. <span aria-hidden="true">({{ .total }})</span>
  7. </h1>
  8. <span class="sr-only">
  9. {{ if .showOnlyUnreadEntries }}
  10. {{ plural "page.unread_entry_count" .total .total }}
  11. {{ else }}
  12. {{ plural "page.total_entry_count" .total .total }}
  13. {{ end }}
  14. </span>
  15. <nav aria-label="{{ .category.Title }} {{ t "menu.title" }}">
  16. <ul>
  17. {{ if .entries }}
  18. <li>
  19. <button
  20. class="page-button"
  21. data-action="markPageAsRead"
  22. data-label-question="{{ t "confirm.question" }}"
  23. data-label-yes="{{ t "confirm.yes" }}"
  24. data-label-no="{{ t "confirm.no" }}"
  25. data-label-loading="{{ t "confirm.loading" }}"
  26. data-show-only-unread="{{ if .showOnlyUnreadEntries }}1{{ end }}">{{ icon "mark-page-as-read" }}{{ t "menu.mark_page_as_read" }}</button>
  27. </li>
  28. <li>
  29. <button
  30. class="page-button"
  31. data-confirm="true"
  32. data-label-question="{{ t "confirm.question" }}"
  33. data-label-yes="{{ t "confirm.yes" }}"
  34. data-label-no="{{ t "confirm.no" }}"
  35. data-label-loading="{{ t "confirm.loading" }}"
  36. data-url="{{ routePath "/category/%d/mark-all-as-read" .category.ID }}">{{ icon "mark-all-as-read" }}{{ t "menu.mark_all_as_read" }}</button>
  37. </li>
  38. {{ end }}
  39. {{ if .showOnlyUnreadEntries }}
  40. <li>
  41. <a class="page-link" href="{{ routePath "/category/%d/entries/all" .category.ID }}">{{ icon "show-all-entries" }}{{ t "menu.show_all_entries" }}</a>
  42. </li>
  43. <li>
  44. <a class="page-link" href="{{ routePath "/category/%d/entries/starred" .category.ID }}">{{ icon "star" }}{{ t "menu.show_only_starred_entries" }}</a>
  45. </li>
  46. {{ else if .showOnlyStarredEntries }}
  47. <li>
  48. <a class="page-link" href="{{ routePath "/category/%d/entries" .category.ID }}">{{ icon "show-unread-entries" }}{{ t "menu.show_only_unread_entries" }}</a>
  49. </li>
  50. <li>
  51. <a class="page-link" href="{{ routePath "/category/%d/entries/all" .category.ID }}">{{ icon "show-all-entries" }}{{ t "menu.show_all_entries" }}</a>
  52. </li>
  53. {{ else }}
  54. <li>
  55. <a class="page-link" href="{{ routePath "/category/%d/entries" .category.ID }}">{{ icon "show-unread-entries" }}{{ t "menu.show_only_unread_entries" }}</a>
  56. </li>
  57. <li>
  58. <a class="page-link" href="{{ routePath "/category/%d/entries/starred" .category.ID }}">{{ icon "star" }}{{ t "menu.show_only_starred_entries" }}</a>
  59. </li>
  60. {{ end }}
  61. <li>
  62. <a class="page-link" href="{{ routePath "/category/%d/feeds" .category.ID }}">{{ icon "feeds" }}{{ t "menu.feeds" }}</a>
  63. </li>
  64. <li>
  65. <form
  66. action="{{ routePath "/category/%d/entries/refresh" .category.ID }}"
  67. method="post"
  68. class="page-header-action-form"
  69. >
  70. <input type="hidden" name="csrf" value="{{ .csrf }}">
  71. <button class="page-button" data-label-loading="{{ t "confirm.loading" }}">
  72. {{ icon "refresh" }}{{ t "menu.refresh_all_feeds" }}
  73. </button>
  74. </form>
  75. </li>
  76. </ul>
  77. </nav>
  78. </section>
  79. {{ end }}
  80. {{ define "content"}}
  81. {{ if not .entries }}
  82. <p role="alert" class="alert">{{ t "alert.no_category_entry" }}</p>
  83. {{ else }}
  84. <div class="pagination-top">
  85. {{ template "pagination" .pagination }}
  86. </div>
  87. <div class="items">
  88. {{ range .entries }}
  89. <article
  90. class="item entry-item {{ if $.user.EntrySwipe }}entry-swipe{{ end }} item-status-{{ .Status }}"
  91. data-id="{{ .ID }}"
  92. aria-labelledby="entry-title-{{ .ID }}"
  93. tabindex="-1"
  94. >
  95. <header class="item-header" dir="auto">
  96. <h2 id="entry-title-{{ .ID }}" class="item-title">
  97. <a
  98. {{ if $.showOnlyUnreadEntries }}
  99. href="{{ routePath "/unread/category/%d/entry/%d" .Feed.Category.ID .ID }}"
  100. {{ else if $.showOnlyStarredEntries }}
  101. href="{{ routePath "/starred/category/%d/entry/%d" .Feed.Category.ID .ID }}"
  102. {{ else }}
  103. href="{{ routePath "/category/%d/entry/%d" .Feed.Category.ID .ID }}"
  104. {{ end }}
  105. {{ if and $.user.AlwaysOpenExternalLinks $.user.OpenExternalLinksInNewTab }}target="_blank"{{ end }}
  106. >
  107. {{ if ne .Feed.Icon.IconID 0 }}
  108. <img src="{{ routePath "/feed-icon/%s" .Feed.Icon.ExternalIconID }}" width="16" height="16" loading="lazy" alt="">
  109. {{ end }}
  110. {{ .Title }}
  111. </a>
  112. </h2>
  113. <span class="category">
  114. <a href="{{ routePath "/category/%d/entries" .Feed.Category.ID }}" aria-label="{{ t "page.category_label" .Feed.Category.Title }}">
  115. {{ .Feed.Category.Title }}
  116. </a>
  117. </span>
  118. </header>
  119. {{ template "item_meta" dict "user" $.user "entry" . "hasSaveEntry" $.hasSaveEntry }}
  120. </article>
  121. {{ end }}
  122. </div>
  123. <section class="page-footer">
  124. {{ if .entries }}
  125. <ul>
  126. <li>
  127. <button
  128. class="page-button"
  129. data-action="markPageAsRead"
  130. data-label-question="{{ t "confirm.question" }}"
  131. data-label-yes="{{ t "confirm.yes" }}"
  132. data-label-no="{{ t "confirm.no" }}"
  133. data-label-loading="{{ t "confirm.loading" }}"
  134. data-show-only-unread="{{ if .showOnlyUnreadEntries }}1{{ end }}">{{ icon "mark-page-as-read" }}{{ t "menu.mark_page_as_read" }}</button>
  135. </li>
  136. </ul>
  137. {{ end }}
  138. </section>
  139. <div class="pagination-bottom">
  140. {{ template "pagination" .pagination }}
  141. </div>
  142. {{ end }}
  143. {{ end }}