blob: 9140348217bdf92e94beb6d3b4151d393fce6ebf [file] [log] [blame]
<!--
Copyright 2020 The Go Authors. All rights reserved.
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file.
-->
{{define "unit_meta"}}
<div class="UnitMeta">
<h2 class="UnitMeta-detailsTitle">Details</h2>
<div class="UnitMeta-details">
{{template "unit_meta_details" .}}
</div>
<div class="UnitMeta-learn">
<a href="/about#best-practices-h2">Learn more</a>
</div>
<h2 class="UnitMeta-repoTitle">Repository</h2>
<div class="UnitMeta-repo">
{{if .Details.RepositoryURL}}
<a href="{{.Details.RepositoryURL}}" title="{{.Details.RepositoryURL}}" target="_blank" rel="noopener">
{{stripscheme .Details.RepositoryURL}}
</a>
{{else}}
Repository URL not available.
{{end}}
</div>
{{if or .Details.ReadmeLinks .Details.DocLinks .Details.ModuleReadmeLinks}}
<h2 class="UnitMeta-linksTitle">Links</h2>
{{end}}
<div class="UnitMeta-links">
<ul>
{{template "unit_meta_links" .Details.ReadmeLinks}}
{{template "unit_meta_links" .Details.DocLinks}}
{{template "unit_meta_links" .Details.ModuleReadmeLinks}}
</ul>
</div>
</div>
{{end}}
{{define "unit_meta_links"}}
{{range .}}
<li>
<a href="{{.Href}}" title="{{.Href}}" target="_blank" rel="noopener"
data-test-id="meta-link-{{.Body}}">{{.Body}}</a>
</li>
{{end}}
{{end}}
{{define "unit_meta_details_toggletip"}}
<span class="UnitMetaDetails-toggletip">
<button type="button" aria-label="more info" data-toggletip-content="{{.}}">
<img class="UnitMetaDetails-icon" src="/static/legacy/img/pkg-icon-help_24x24.svg" alt="" height="24" width="24">
</button>
<span role="status"></span>
</span>
{{end}}
{{define "unit_meta_details_check"}}
<img class="UnitMetaDetails-icon"
{{- if . -}}
src="/static/legacy/img/pkg-icon-checkCircleOutline_24x24.svg" alt="checked"
{{- else -}}
src="/static/legacy/img/pkg-icon-cancel_24x24.svg" alt="unchecked"
{{- end -}}
height="24" width="24">
{{end}}
{{define "unit_meta_details"}}
<ul>
<li>
{{template "unit_meta_details_check" .Unit.HasGoMod}}
Valid {{if .Unit.HasGoMod}}<a href="{{.Details.ModFileURL}}" target="_blank">{{end}}go.mod{{if .Unit.HasGoMod}}</a>{{end}} file
{{template "unit_meta_details_toggletip" "The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go."}}
</li>
<li>
{{template "unit_meta_details_check" .Unit.IsRedistributable}}
Redistributable license
{{template "unit_meta_details_toggletip" "Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed."}}
</li>
<li>
{{template "unit_meta_details_check" .Details.IsTaggedVersion}}
Tagged version
{{template "unit_meta_details_toggletip" "Modules with tagged versions give importers more predictable builds."}}
</li>
<li>
{{template "unit_meta_details_check" .Details.IsStableVersion}}
Stable version
{{template "unit_meta_details_toggletip" "When a project reaches major version v1 it is considered stable."}}
</li>
</ul>
{{end}}