gitlin/views/repo.html
2023-02-14 20:51:44 +05:30

66 行
2.3 KiB
HTML

{{ template "header" .}}
<main>
{{ if .repo }}
{{ range $key, $value := .repo}}
<div class="buttonParent">
<a href="/download/{{.Fullname}}/{{.DefaultBranch}}" class="button">Download (zip)</a>
<a href="https://github.com/{{.Fullname}}" class="button">View on GitHub</a>
</div>
<div class="userProfile">
<h1>{{.Fullname}}</h1>
{{ if .Parent }}
<p>This repository is a fork of <a href="/{{.Parent}}">{{.Parent}}</a>.</p>
{{ end }}
{{ if .Description }}
<p>{{.Description}}</p>
{{ end }}
{{ if .License }}
<p>⭐ {{.Stars}} 🍴 {{.Forks}} 👀 {{.Watchers}} ⚖️ {{.License}} 🌿 {{.DefaultBranch}}</p>
{{ else }}
<p>⭐ {{.Stars}} 🍴 {{.Forks}} 👀 {{.Watchers}} ⚖️ No license 🌿 {{.DefaultBranch}}</p>
{{ end }}
{{ if .Language }}
<p>🗒️
{{range .Language}}
{{.}}
{{end}}
</p>
{{end}}
</div>
{{end}}
{{ if .files}}
<div class="userReadme">
<h3>Files</h3>
<div class="userReadmeText">
<ul class="filesUList">
{{ range $key, $value := .files}}
{{ if eq .Type "dir" }}
<li class="filesList"><a href="#" class="filesA">{{.Path}} (directory)</a></li>
{{ else }}
<li class="filesList"><a href="/{{.Fullname}}/tree/{{.DefaultBranch}}/{{.Path}}">{{.Path}}</a></li>
{{ end }}
{{ end }}
</ul>
</div>
</div>
{{ end }}
{{ if .readme}}
<div class="userReadme">
{{ if .repo }}
{{ range $key, $value := .repo}}
<h3>{{.Readme}}</h3>
{{end}}
{{end}}
<div class="userReadmeText">
{{ unescape .readme}}
</div>
</div>
{{ end }}
{{ else }}
<h2>Repository not found</h2>
<p>That repository doesn't exist.</p>
{{ end }}
</main>