forked from tangled.org/core
this repo has no description

appview: fix compare page when repo has only 1 branch

the "recently active branches" panel is not shown when there are no
branches to show.

Signed-off-by: oppiliappan <me@oppi.li>

oppi.li 93f3a461 9243b43c

verified
Changed files
+19 -20
appview
pages
templates
repo
compare
+19 -20
appview/pages/templates/repo/compare/new.html
··· 7 7 {{ end }} 8 8 9 9 {{ define "repoAfter" }} 10 - <section class="p-6 mt-4 rounded-br rounded-bl bg-white dark:bg-gray-800 dark:text-white drop-shadow-sm w-full mx-auto"> 11 - <div class="flex flex-col items-center"> 12 - <p class="text-center text-black dark:text-white"> 13 - Recently updated branches in this repository: 14 - </p> 15 - {{ block "recentBranchList" $ }} {{ end }} 16 - </div> 17 - </section> 18 - {{ end }} 19 - 20 - {{ define "recentBranchList" }} 21 - <div class="mt-4 grid grid-cols-1 divide-y divide-gray-200 dark:divide-gray-700 rounded border border-gray-200 dark:border-gray-700 w-full md:w-1/2"> 22 - {{ range $br := take .Branches 5 }} 23 - <a href="/{{ $.RepoInfo.FullName }}/compare?head={{ $br.Name | urlquery }}" class="no-underline hover:no-underline"> 24 - <div class="flex items-center justify-between p-2"> 25 - {{ $br.Name }} 26 - <time class="text-gray-500 dark:text-gray-400">{{ timeFmt $br.Commit.Committer.When }}</time> 10 + {{ $brs := take .Branches 5 }} 11 + {{ if $brs }} 12 + <section class="p-6 mt-4 rounded-br rounded-bl bg-white dark:bg-gray-800 dark:text-white drop-shadow-sm w-full mx-auto"> 13 + <div class="flex flex-col items-center"> 14 + <p class="text-center text-black dark:text-white"> 15 + Recently updated branches in this repository: 16 + </p> 17 + <div class="mt-4 grid grid-cols-1 divide-y divide-gray-200 dark:divide-gray-700 rounded border border-gray-200 dark:border-gray-700 w-full md:w-1/2"> 18 + {{ range $br := $brs }} 19 + <a href="/{{ $.RepoInfo.FullName }}/compare?head={{ $br.Name | urlquery }}" class="no-underline hover:no-underline"> 20 + <div class="flex items-center justify-between p-2"> 21 + {{ $br.Name }} 22 + <time class="text-gray-500 dark:text-gray-400">{{ timeFmt $br.Commit.Committer.When }}</time> 23 + </div> 24 + </a> 25 + {{ end }} 26 + </div> 27 27 </div> 28 - </a> 29 - {{ end }} 30 - </div> 28 + </section> 29 + {{ end }} 31 30 {{ end }}