this repo has no description
1{{ define "title" }}issues · {{ .RepoInfo.FullName }}{{ end }}
2
3{{ define "extrameta" }}
4 {{ $title := "issues"}}
5 {{ $url := printf "https://tangled.org/%s/issues" .RepoInfo.FullName }}
6
7 {{ template "repo/fragments/og" (dict "RepoInfo" .RepoInfo "Title" $title "Url" $url) }}
8{{ end }}
9
10{{ define "repoContent" }}
11 {{ $active := "closed" }}
12 {{ if .FilteringByOpen }}
13 {{ $active = "open" }}
14 {{ end }}
15
16 {{ $open :=
17 (dict
18 "Key" "open"
19 "Value" "open"
20 "Icon" "circle-dot"
21 "Meta" (string .RepoInfo.Stats.IssueCount.Open)) }}
22 {{ $closed :=
23 (dict
24 "Key" "closed"
25 "Value" "closed"
26 "Icon" "ban"
27 "Meta" (string .RepoInfo.Stats.IssueCount.Closed)) }}
28 {{ $values := list $open $closed }}
29
30 <div class="grid gap-2 grid-cols-[auto_1fr_auto] grid-row-2">
31 <form class="flex relative col-span-3 sm:col-span-1 sm:col-start-2" method="GET">
32 <input type="hidden" name="state" value="{{ if .FilteringByOpen }}open{{ else }}closed{{ end }}">
33 <div class="flex-1 flex relative">
34 <input
35 class="flex-1 py-1 pl-2 pr-10 mr-[-1px] rounded-r-none focus:border-0 focus:outline-none focus:ring focus:ring-blue-400 ring-inset peer"
36 type="text"
37 name="q"
38 value="{{ .FilterQuery }}"
39 placeholder=" "
40 >
41 <a
42 href="?state={{ if .FilteringByOpen }}open{{ else }}closed{{ end }}"
43 class="absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hidden peer-[:not(:placeholder-shown)]:block"
44 >
45 {{ i "x" "w-4 h-4" }}
46 </a>
47 </div>
48 <button
49 type="submit"
50 class="p-2 text-gray-400 border rounded-r border-gray-400 dark:border-gray-600"
51 >
52 {{ i "search" "w-4 h-4" }}
53 </button>
54 </form>
55 <div class="sm:row-start-1">
56 {{ template "fragments/tabSelector" (dict "Name" "state" "Values" $values "Active" $active) }}
57 </div>
58 <a
59 href="/{{ .RepoInfo.FullName }}/issues/new"
60 class="col-start-3 btn-create text-sm flex items-center justify-center gap-2 no-underline hover:no-underline hover:text-white"
61 >
62 {{ i "circle-plus" "w-4 h-4" }}
63 <span>new</span>
64 </a>
65 </div>
66 <div class="error" id="issues"></div>
67{{ end }}
68
69{{ define "repoAfter" }}
70 <div class="mt-2">
71 {{ template "repo/issues/fragments/issueListing" (dict "Issues" .Issues "RepoPrefix" .RepoInfo.FullName "LabelDefs" .LabelDefs) }}
72 </div>
73 {{if gt .IssueCount .Page.Limit }}
74 {{ block "pagination" . }} {{ end }}
75 {{ end }}
76{{ end }}
77
78{{ define "pagination" }}
79<div class="flex justify-center items-center mt-4 gap-2">
80 {{ $currentState := "closed" }}
81 {{ if .FilteringByOpen }}
82 {{ $currentState = "open" }}
83 {{ end }}
84
85 {{ $prev := .Page.Previous.Offset }}
86 {{ $next := .Page.Next.Offset }}
87 {{ $lastPage := sub .IssueCount (mod .IssueCount .Page.Limit) }}
88
89 <a
90 class="
91 btn flex items-center gap-2 no-underline hover:no-underline
92 dark:text-white dark:hover:bg-gray-700
93 {{ if le .Page.Offset 0 }}
94 cursor-not-allowed opacity-50
95 {{ end }}
96 "
97 {{ if gt .Page.Offset 0 }}
98 hx-boost="true"
99 href = "/{{ $.RepoInfo.FullName }}/issues?state={{ $currentState }}&q={{ .FilterQuery }}&offset={{ $prev }}&limit={{ .Page.Limit }}"
100 {{ end }}
101 >
102 {{ i "chevron-left" "w-4 h-4" }}
103 previous
104 </a>
105
106 <!-- dont show first page if current page is first page -->
107 {{ if gt .Page.Offset 0 }}
108 <a
109 hx-boost="true"
110 href = "/{{ $.RepoInfo.FullName }}/issues?state={{ $currentState }}&q={{ .FilterQuery }}&offset=0&limit={{ .Page.Limit }}"
111 >
112 1
113 </a>
114 {{ end }}
115
116 <!-- if previous page is not first or second page (prev > limit) -->
117 {{ if gt $prev .Page.Limit }}
118 <span>...</span>
119 {{ end }}
120
121 <!-- if previous page is not the first page -->
122 {{ if gt $prev 0 }}
123 <a
124 hx-boost="true"
125 href = "/{{ $.RepoInfo.FullName }}/issues?state={{ $currentState }}&q={{ .FilterQuery }}&offset={{ $prev }}&limit={{ .Page.Limit }}"
126 >
127 {{ add (div $prev .Page.Limit) 1 }}
128 </a>
129 {{ end }}
130
131 <!-- current page. this is always visible -->
132 <span class="font-bold">
133 {{ add (div .Page.Offset .Page.Limit) 1 }}
134 </span>
135
136 <!-- if next page is not last page -->
137 {{ if lt $next $lastPage }}
138 <a
139 hx-boost="true"
140 href = "/{{ $.RepoInfo.FullName }}/issues?state={{ $currentState }}&q={{ .FilterQuery }}&offset={{ $next }}&limit={{ .Page.Limit }}"
141 >
142 {{ add (div $next .Page.Limit) 1 }}
143 </a>
144 {{ end }}
145
146 <!-- if next page is not second last or last page (next < issues - 2 * limit) -->
147 {{ if lt ($next) (sub .IssueCount (mul (2) .Page.Limit)) }}
148 <span>...</span>
149 {{ end }}
150
151 <!-- if its not the last page -->
152 {{ if lt .Page.Offset $lastPage }}
153 <a
154 hx-boost="true"
155 href = "/{{ $.RepoInfo.FullName }}/issues?state={{ $currentState }}&q={{ .FilterQuery }}&offset={{ $lastPage }}&limit={{ .Page.Limit }}"
156 >
157 {{ add (div $lastPage .Page.Limit) 1 }}
158 </a>
159 {{ end }}
160
161 <a
162 class="
163 btn flex items-center gap-2 no-underline hover:no-underline
164 dark:text-white dark:hover:bg-gray-700
165 {{ if ne (len .Issues) .Page.Limit }}
166 cursor-not-allowed opacity-50
167 {{ end }}
168 "
169 {{ if eq (len .Issues) .Page.Limit }}
170 hx-boost="true"
171 href="/{{ $.RepoInfo.FullName }}/issues?state={{ $currentState }}&q={{ .FilterQuery }}&offset={{ $next }}&limit={{ .Page.Limit }}"
172 {{ end }}
173 >
174 next
175 {{ i "chevron-right" "w-4 h-4" }}
176 </a>
177</div>
178{{ end }}