This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

core / appview / pages / templates / repo / tree.html
4.8 kB 117 lines
1{{ define "title"}}{{ range .BreadCrumbs }}{{ pathUnescape (index . 0)}}/{{ end }} at {{ .Ref }} &middot; {{ .RepoInfo.FullName }} &middot; Tangled{{ end }} 2 3 4{{ define "extrameta" }} 5 6 {{ $path := "" }} 7 {{ range .BreadCrumbs }} 8 {{ $path = printf "%s/%s" $path (index . 0) }} 9 {{ end }} 10 11 {{ template "repo/fragments/meta" . }} 12 {{ $title := printf "%s at %s &middot; %s" $path .Ref .RepoInfo.FullName }} 13 {{ $url := printf "https://tangled.org/%s/tree/%s%s" .RepoInfo.FullName .Ref $path }} 14 15 {{ template "repo/fragments/og" (dict "RepoInfo" .RepoInfo "Title" $title "Url" $url) }} 16{{ end }} 17 18 19{{define "repoContent"}} 20<main> 21 <div class="tree"> 22 {{ $linkstyle := "no-underline hover:underline" }} 23 24 <div class="mb-3 text-sm flex justify-between gap-2 items-center"> 25 <div class="flex gap-3 items-center"> 26 <div class="bg-gray-100 dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded p-2 flex items-center gap-1 overflow-x-auto whitespace-nowrap w-fit"> 27 {{ $last := sub (len .BreadCrumbs) 1 }} 28 {{ range $i, $b := .BreadCrumbs }} 29 {{ if (ne $i $last) }} 30 <a href="{{ index $b 1 }}" class="text-gray-500 dark:text-gray-400 {{ $linkstyle }}">{{ pathUnescape (index $b 0) }}</a> 31 <span class="text-gray-500 dark:text-gray-400">/</span> 32 {{ else }} 33 <span class="text-black dark:text-white">{{ pathUnescape (index $b 0) }}</span> 34 {{ end }} 35 {{ end }} 36 </div> 37 <div class="text-sm text-gray-500 dark:text-gray-400 flex items-center gap-2"> 38 {{ $stats := .TreeStats }} 39 {{ if eq $stats.NumFolders 1 }} 40 <span>{{ $stats.NumFolders }} folder</span> 41 {{ else if gt $stats.NumFolders 1 }} 42 <span>{{ $stats.NumFolders }} folders</span> 43 {{ end }} 44 45 {{ if and (gt $stats.NumFolders 0) (gt $stats.NumFiles 0) }} 46 <span class="select-none [&:before]:content-['·']"></span> 47 {{ end }} 48 49 {{ if eq $stats.NumFiles 1 }} 50 <span>{{ $stats.NumFiles }} file</span> 51 {{ else if gt $stats.NumFiles 1 }} 52 <span>{{ $stats.NumFiles }} files</span> 53 {{ end }} 54 </div> 55 </div> 56 <div class="bg-gray-100 dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded p-2 hidden md:flex items-center gap-2 whitespace-nowrap"> 57 <span class="text-gray-500 dark:text-gray-400">at <a href="/{{ $.RepoInfo.FullName }}/tree/{{ pathEscape $.Ref }}" class="{{ $linkstyle }}">{{ $.Ref }}</a></span> 58 </div> 59 </div> 60 61 {{ if .LastCommitInfo }} 62 {{ template "repo/fragments/lastCommitPanel" $ }} 63 {{ end }} 64 65 {{ range .Files }} 66 <div class="grid grid-cols-12 gap-4 items-center py-1"> 67 <div class="col-span-8 md:col-span-4"> 68 {{ $link := printf "/%s/%s/%s/%s/%s" $.RepoInfo.FullName "tree" (pathEscape $.Ref) $.Path .Name }} 69 {{ $icon := "folder" }} 70 {{ $iconStyle := "size-4 fill-current" }} 71 72 {{ if .IsSubmodule }} 73 {{ $link = printf "/%s/%s/%s/%s/%s" $.RepoInfo.FullName "blob" (urlquery $.Ref) $.Path .Name }} 74 {{ $icon = "folder-input" }} 75 {{ $iconStyle = "size-4" }} 76 {{ end }} 77 78 {{ if .IsFile }} 79 {{ $link = printf "/%s/%s/%s/%s/%s" $.RepoInfo.FullName "blob" (urlquery $.Ref) $.Path .Name }} 80 {{ $icon = cond .IsSymlink "file-symlink" "file" }} 81 {{ $iconStyle = "size-4" }} 82 {{ end }} 83 84 <a href="{{ $link }}" class="{{ $linkstyle }}"> 85 <div class="flex items-center gap-2"> 86 {{ i $icon $iconStyle "flex-shrink-0" }} 87 <span class="truncate">{{ .Name }}</span> 88 </div> 89 </a> 90 </div> 91 92 <div class="col-span-0 md:col-span-6 hidden md:block overflow-hidden"> 93 {{ with .LastCommit }} 94 <a href="/{{ $.RepoInfo.FullName }}/commit/{{ .Hash }}" class="text-gray-500 dark:text-gray-400 block truncate">{{ .Message }}</a> 95 {{ end }} 96 </div> 97 98 <div class="col-span-4 md:col-span-2 text-sm text-right"> 99 {{ with .LastCommit }} 100 <a href="/{{ $.RepoInfo.FullName }}/commit/{{ .Hash }}" class="text-gray-500 dark:text-gray-400">{{ template "repo/fragments/time" .When }}</a> 101 {{ end }} 102 </div> 103 </div> 104 {{ end }} 105 106 </div> 107</main> 108{{ if .LastCommitInfo }} 109 {{ template "repo/fragments/permalinkShortcutScript" (printf "/%s/tree/%s/%s" .RepoInfo.RepoIdentifier .LastCommitInfo.Hash .Path) }} 110{{ end }} 111{{end}} 112 113{{ define "repoAfter" }} 114 {{- if or .HTMLReadme .Readme -}} 115 {{ template "repo/fragments/readme" . }} 116 {{- end -}} 117{{ end }}